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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
zelalemdatew
Contributor II
Contributor II

Conditional Dimension

Hi All

I am working on the a project that requires a conditional dimension. So I have two columns (A and B) I need to use for the chart. But, the issue is I want to group column B in 4 different category based on the count. Please see below:

a.       Less than 20

b.      Between 20 and 24

c.       Between 25 and 29

d.      Greater than 30

Can anyone help me writing this expression please?

Thanks in advance!

 

5 Replies
ajaykakkar93
Specialist III
Specialist III

Hi,

If(B <20 , 'less than 20'

,

If(B >=20 and B<=24,'20-24'

,

If(B >=25 and B<=29,'25-29'

,

If(B >=30,'greater than 30'))))

 

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

ajaykakkar93
Specialist III
Specialist III

Hi,

You can edit & paste this to your back-end final table

& Give a proper columns name to it 

Example:

Load *,

If(......) as brandGroup

Resedent table name;

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

zelalemdatew
Contributor II
Contributor II
Author

Thanks for replying.

Sorry that I wasn't clear enough, but column B is not an integer right now it is string, which I have to count them first based on column A's usage. 

For instance I use your suggestions like: 

If(Count(B) <20 , 'less than 20'
,
If(Count(B) >=20 and Count(B)<=24,'20-24'
,
If(Count(B) >=25 and Count(B)<=29,'25-29'
,
If(Count(B) >=30,'greater than 30'))))

But doesn't seem to work.

I think it is because I am trying to use aggregate functions in Dimensions not in measure.

Thanks!

ajaykakkar93
Specialist III
Specialist III

Can you share a sample data I'll give u a proper code for this

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

zelalemdatew
Contributor II
Contributor II
Author

I figured it out. I did all the condition in the back end instead of in Qlik. Thanks for the help though!