Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
uacg0009
Partner - Specialist
Partner - Specialist

Class function showing issue when using if

Hi all,

I have a problem when I use the class function, please see below :

I have data like :

Class1.PNG

And I use this dimension to show the sum(VALUE) in a chart :

class2.PNG

But it shows like :

class3.PNG

I wonder why it didn't show the 2 <= < 10000,

I just want to show like :

Class4.PNG

I don't know why it shows 0 <=,

could you please help me to do that? Or if you have any other method, please tell me.

The order need to like above and I also try to use like :

if(F1<-100,class(F1,1,''),if(F1<0,class(F1,0.05,''),if(F1<2,class(F1,0.01,''),'         2<=')))

But I think it is a little ugly and it must have better way to do that.

Thanks and any questions please tell me, you can use the attached.

1 Solution

Accepted Solutions
sunny_talwar

May be this as your calculated dimension:

=If(F1 < -100,Class(F1,1,''),
If(F1 < 0,Class(F1,0.05,''),
If(F1 < 2,Class(F1,0.01,''),

If(F1 < 10000 and F1 >= 2, Dual('2 <= < 10000', 5001), '        2<='))))

Capture.PNG

View solution in original post

4 Replies
sunny_talwar

May be this as your calculated dimension:

=If(F1 < -100,Class(F1,1,''),
If(F1 < 0,Class(F1,0.05,''),
If(F1 < 2,Class(F1,0.01,''),

If(F1 < 10000 and F1 >= 2, Dual('2 <= < 10000', 5001), '        2<='))))

Capture.PNG

uacg0009
Partner - Specialist
Partner - Specialist
Author

Hi Sunny,

Thanks for your reply.

This is my first time to use DUAL function, if possible could you please tell me when I can use it?

And I have another question Dual('2 <= < 10000', 5001) in your suggestion : can I change the 5001 to any number? do some other columns will affect the column's value when I use 5001, or the value will affect other columns value when i use 5001?

I am just afraid of that.

Thanks again.

sunny_talwar

I put the number 5001 as an average of 2 and 10000, but I think the idea is to put a number which would making the sorting correct. This number can be any number bigger than 2 in your case.

Dual function is a function which is used when you want to assign a numeric value to a text. In this case '2 <= < 10000' is text, but it also was assigned a numeric value of 5001. Again did it so that it can be sorted properly.

HTH

uacg0009
Partner - Specialist
Partner - Specialist
Author

Got it! Thank you so much for your help!

But do you know why the class shows wrong if I use like that?