Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a range representing a count of days. The functions below categorize them into 5 year segments for the X axis of a histogram.
this one works, but is incomplete:
subfield(class(Days_to_TRD/365,5),' <= x < ',1) & '-'
this one stops showing any values:
subfield(class(Days_to_TRD/365,5),' <= x < ',1) & '-'& subfield(class(Days_to_TRD/365,5),' <= x < ',2)-1
It's as if Qlik doesn't know how to define the buckets when more than one class statement is used. Can anyone tell me what I'm doing wrong?
Do I need to create the classes during the data load instead?
=Dual(Replace(Class(Days_to_TRD/365,5),'<= x <','to'), Num(Class(Days_to_TRD/365,5)))
Hi Todd,
try this
Floor(Days_to_TRD/365,5)&'-'&(Floor(Days_to_TRD/365,5)+4)
Regards,
Antonio
Class has a third parameter which could define how class displays the results - therefore try just this:
class(Days_to_TRD/365,5, '-')
Beside them your second approach couldn't work because it creates a pure string-value and not a numeric number. If you want to display a certain formatting (which couldn't be reached with a formatting-function) you need to use a dual-function in which the string-part could be manipulated in various ways, for example with any string-functions maybe like this:
dual(replace(class(Days_to_TRD/365,5), ' <= x < ', '-'), num(class(Days_to_TRD/365,5)))
- Marcus
Try this:
Replace(Class(Days_to_TRD/365,5),'<= x <', '1')& '-'& Replace(Class(Days_to_TRD/365,5),'<= x <', '2')-1
=dual(REPLACE(CLASS(Days_to_TRD/365,5), '<= x <','1') & '-', CLASS(Days_to_TRD/365,5))
=Dual(Replace(Class(Days_to_TRD/365,5),'<= x <','to'), Num(Class(Days_to_TRD/365,5)))
thanks. The Dual function is new to me. The formula works like charm. I'll need to learn more about Dual. 🙂