Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to create sales range expression

Hi all,

I am new using QS, and I have difficult to create this exp.

let say I have database

Style Sales

A      100

B       50

C       20

D      250

and I want to create style group which are

Sales with 0 - 20 how many style

sales with more than 100 how many style.

Can you guys help me with this ?

Really appreciate with your help.

Thanks

Henry

3 Replies
tresesco
MVP
MVP

Try using calculated dimension: If(Sales<=20, '<=20', if(Sales>=100, '>=100'))

Exp: Count(Style)

Anonymous
Not applicable
Author

If the groups you want are evenly spaced then you could use the class function to create a calculated dimension.

However in this case, you would need to write a specific calculated dimension.

eg for what you want, the dimension would be

if(Sales<=20,'<=20',if(Sales>100,'>100','Other'))

This would create 3 dimensions, a group for 0-20 called '<=20',one for over 100 called '>100' and the rest lumped into a group called 'Other'.

I've attached a .qvf file as an example for you with your sample data simply counting how many are in each group.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Implementing this in script is a best practice, try using below script

TableName:

LOAD

*,

If(Sales<=20, '<=20', if(Sales>=100, '>=100', 'N/A')) AS Range

FROM DataSource;

Now in chart use Range as dimension and Count(Style) OR Count(Distinct Style) as expression.

Regards,

Jagan.