Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a dimension field Days which contains number of days. I need to categerise those days in to 4 categeories
Like <180, 181-360, 361-540, >540. For that I need expression
Thanks,
MLNR
Hi,
Try to create the buckets
Load
if(Day < 180,'<180',
If(Day > 180 and Day < 360, '360',
If(Day > 361 and Day < 540,'>361-540',
If(Day >540,'>540')))) as DayBucket
From Source;
Or you can use the Class function in the front end.
Regards
Anand
Hi,
Read Article written by Henric about how to create bucket
http://community.qlik.com/blogs/qlikviewdesignblog/2014/07/14/buckets
Regards
Hi,
Better you load this way example with simple bucket creation in the load script.
1.
Data:
LOAD RowNo() as Day
AutoGenerate 1000;
LOAD
Day,
if(Day <= 180,'<180',
If(Day >= 180 and Day <= 360, '>180-360',
If(Day >= 361 and Day <= 540, '>361-540',
If(Day >540,'>540')))) as DayBucket
Resident Data;
DROP Table Data;
2. And in Dimension you can use without creating buckets
=Class(Day,180)
Regards
Anand
try with INTERVALMATCH() function
The general syntax is:
intervalmatch (matchfield) (loadstatement | selectstatement )
matchfield is the field containing the discrete numeric values to be linked to intervals.
loadstatement or selectstatement must result in a two-column table, where the first field contains the lower limit of each interval and the second field contains the upper limit of each interval. The intervals are always closed, i.e. the end points are included in the interval. Non-numeric limits render the interval to be disregarded (undefined).