Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

question in Qlik sense

2 columns in table:

one column :unit no. (i.e 34243) and the second : corresponding distance data (i.e 1.1767).

Need:

To write for each distace range (0-1, 1.5-2) how many units there are in that range.

What query do i have to use in the expression editor?

thanks in advance!

5 Replies
Not applicable

Re: question in Qlik sense

Dimension:

class(Distance)

Measure: count(UnitNo)

I.e. you use a calculated dimension.

Not applicable

Re: question in Qlik sense

can you help me with syntax of class? for example if i want  between the range 1-1.5 miles

Not applicable

Re: question in Qlik sense

If you want each half mile, and the Distance field is in units of Miles, then

class(Distance, 0.5)

will work.

MVP
MVP

Re: question in Qlik sense

Hi,

Try like this in script

LOAD

*,

If(distance > 1.5 AND distance <=2, '1.5-2',

     If(distance >0 AND distance <= 1, '0-1', 'Other')) AS Range

FROM DataSource;

Now in just use this

Dimension: Range

Expression: Count(UnitNo)

Hope this helps you.

Regards,

Jagan.

Not applicable

Re: question in Qlik sense

you gave me this solution and it worked:


class(Distance, 0.5)


Now instead of Distance data  I created calc dimension which called CalcDist, in Qlik sense


But if Now I change the name of the field in the command:


class(CalcDist, 0.5)


it says it is bad field name..


any advise??