Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
eliko_il
Contributor
Contributor

how to create different bin range using class function

hi all,

assuming i have this table:

col1col2
A

272

A214
A483
B457
B278
B327
B363
A324
B433
A153
B596
A350
A153
B520
A343
B325
A433

I want to create bar chart with x-axis as the following bin range:

<200 , 200-250, 251-300,301-350, 351-400, >400

i try the class function (  class(col2,50)  ), but i need the option to create also min range (<200) and max range(>400).

In the class function it create with final range.

The y-axis  just count freq of A according to the bin range.

does anyone have a solution (without change or add any data to the DB)?

thnx.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try something like this:

=if(Col2<200,'<200',if(Col2>400,'400',class(Col2,50)))


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Try something like this:

=if(Col2<200,'<200',if(Col2>400,'400',class(Col2,50)))


talk is cheap, supply exceeds demand
eliko_il
Contributor
Contributor
Author

thnx Gysbert, but i still have 2 problems:

First- i want to sort the x-axis as: col2<200,200-250,251-300, .... , col2>400 i try sort by expression but it didnt work.

Second- i want to color the min col and the max col with different colors than the rest of the cols.