Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Dayna
Creator II
Creator II

Class Function, or not Class Function?

Hey All,

I think I need your advice/assistance, I would like to be able to achieve the following:

I have an expression that shows me how many items are due, this is done by today()-Due Date, which wrapped in num() gives me the amount of days its due. Anything that isn't currently due is 0.

What I would like, is selectors that I can use in a list box and as a pivot table with the following:

0, 0 -30, 30-60, 60-90, 90-year, year+.

I was originally of thinking the Class function, but I'm struggling as unsure how to achieve '0' and the 90-year and year+...

Do you have any ideas? As always, help is most appreciated!!!

Kind Regards,
Dayna

Labels (1)
2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Dayna

I have used an inline table and INTERVAL match for the same effect. See the example script below:


First define the bands. I use duals, but this is not strictly necessary for the interval match:
//----------------------------------------------------------------------------
// Bands for interval matching to the last distance measure
//----------------------------------------------------------------------------
DISTANCEBANDS:
LOAD Dual(BandName, DistMin) AS DistanceBand,
DistMin,
DistMax
INLINE
[
BandName, DistMin, DistMax
'No move', 0, 0
'<1000km', 1, 1000
'1001-5000km', 1000, 5000
'5001-10000km', 5000, 10000
'10000-20000km', 10000, 20000
'>20000km', 20000,
];
Then interval match to the LastDistance field in the main data set:
LEFT JOIN(LASTREAD)
INTERVALMATCH (LastDistance) LOAD DistMin, DistMax RESIDENT DISTANCEBANDS;


Hope this helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable

Hello,

I once read in this forum, that everything below xx intervals can be easily achieved by an nested IF-statement during load time without performance issues. if (val<0, '<0', if( val<10, '0-10', if(val<20,'10-20','>20')))

xx was an actually big number, personally I would go max. until 10.

hth,
Thilo