Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

Rang as dimension

Hi,

I have a field that has Nrs in it

Total

75

200

250

320

155

I am trying to build a chart where the dimension is a range 

like the bar chart will show as follow

bar one  is <100  and the sum is 75

bar two  is (>=100 and <= 250) and the sum is 605

bar three is >300 and sum is 320

Anybody knows what should be the dimension for that or If I have to do  that in the script then what should I type.

Thanks for your help.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can use a calculated dimension in your chart:

=if( FIELD <100, '<100',

      if( FIELD <=250, '>=100 and <=250',

      if( FIELD >300,'>300')))

and as expression

=sum(FIELD)

Maybe even better would be to calculate a new field in the script:

LOAD

FIELD,

if( FIELD <100, '<100', if( FIELD <=250, '>=100 and <=250', if( FIELD >300,'>300'))) as CLASS,

...

FROM ..;

Then use that CLASS field in the chart.

[Note that your CLASS has a gap between 250 and 300]

And if your classification bins are equally wide, you could also use QV class() function.

Hope this helps,

Stefan

View solution in original post

2 Replies
swuehl
MVP
MVP

You can use a calculated dimension in your chart:

=if( FIELD <100, '<100',

      if( FIELD <=250, '>=100 and <=250',

      if( FIELD >300,'>300')))

and as expression

=sum(FIELD)

Maybe even better would be to calculate a new field in the script:

LOAD

FIELD,

if( FIELD <100, '<100', if( FIELD <=250, '>=100 and <=250', if( FIELD >300,'>300'))) as CLASS,

...

FROM ..;

Then use that CLASS field in the chart.

[Note that your CLASS has a gap between 250 and 300]

And if your classification bins are equally wide, you could also use QV class() function.

Hope this helps,

Stefan

alec1982
Specialist II
Specialist II
Author

Thank you much!