User Tools

Site Tools


transformations:intervalmerge

This is an old revision of the document!


INTERVAL MERGE

Category: Transform / Advanced


Description

This action merges two tables based on whether a value in one table falls into a range specified by two values in another table.

The lower boundary of a range is inclusive, the upper is exclusive. Ranges can overlap. In such cases, one row for each match will be inserted into the resulting table.


Use cases

Interval merge can be used to to categorize or "bucket" values in a dataset that fall within a given range or scale, such as survey responses (1-3 = "bad", 4-6 = "neutral", 7-10 = "good"), temperature ranges, size scales, etc.

This action is a good substitute for a Lookup action that uses multiple lookup values with similar return values (e.g., 1="good", 2="good", 3="neutral", 4="bad", 5="bad).


Action settings

SettingDescription
Merge tableSelect the table to merge with the current dataset.
ColumnsSelect whether to merge all columns in the second dataset, or just selected columns. Options: All columns or
Selected columns (choose which columns to include in the merge).

The reference to the second table will appear as a dotted line connecting this action to the second dataset in the application window.


Remarks

To create a lookup set that doesn't contain any "gaps" be sure to set the "less than" value one higher than the last value you want included in the range, and start the following pairing with that same value.

Low High Label
0 4 Range is 0 to 3
4 8 Range is 4 to 7 (don't start with "5" or you'll lose "4")
8 11 Range is 8 to 10. (range end is "10" as "11" is excluded)


Examples

Objective: Find what it feels like in Toronto during the year.

Table 1: Temperature in Toronto (Celsius)

Month Temp High (C)
Jan 0
Feb 0
Mar 4
Apr 12
May 19
Jun 24
Jul 27
Aug 26
Sep 23
Oct 15
Nov 9
Dec 3

Table 2: Boundaries

Lower Upper Feels
0 15Cold
15 25Comfortable
25 99Hot


Action parameters:

Table to merge is "Table 2"
Values in column (Table 1) is "Temp High (C)"
Are greater than or equal to "Lower" (in Table 2)
And less than "Upper" (in Table 2)


Result:

Month High, C Feels
Jan 0Cold
Feb 0Cold
Mar 4Cold
Apr 12Cold
May 19Comfortable
Jun 24Comfortable
Jul 27Hot
Aug 26Hot
Sep 23Comfortable
Oct 15Comfortable
Nov 9Cold
Dec 3Cold


See also

transformations/intervalmerge.1618106408.txt.gz · Last modified: 2021/04/10 22:00 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki