Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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
MVP
MVP

Re: how to create sales range expression

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

Exp: Count(Style)

tap
Contributor

Re: how to create sales range expression

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.

MVP
MVP

Re: how to create sales range expression

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.

Community Browser