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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression in Pivot Table with values depending on Dimension

In a Pivot Table, I would like to have one expression with value depending on the value for a dimension. I tried this syntax as an example:

IF({<[Product Sub Group Desc]={'Beer'}>},'Cat1','Others')

If dimension Product Sub Group Desc equals 'Beer', I would like Expression to be 'Cat1', else Expression should be 'Others'. Is it an option and how to do it ?

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Create a calculated dimension: =IF([Product Sub Group Desc]='Beer','Cat1','Others')


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks a lot

I have another similar challenge...

Looking for year of first revenues for one entry in pivot table:

year_first_rev.PNG.png

I add a dimension based on this expression:

=IF([Expenses $(=(vCurrentYear)-2)]=0, IF([Expenses $(=(vCurrentYear)-1)]=0, IF([Expenses $(=(vCurrentYear))]=0, 'None',$(=(vCurrentYear)) ),$(=(vCurrentYear)-1) ), $(=(vCurrentYear)-2)), $(=(vCurrentYear)-2))

I am trying to obtain 2009 if revenues of 2009 are non zero, 2010 if revenues of 2009 are 0 and revenues of 2010 are non zeros and 2011 if revenues of 2009 and 2010 are zeros but revenues of 2011 are non zeros (else, 'None').

The string I propose is not doing it. What could solve the problem ? Is there another way to achieve it (with variables for instance).

If I try simply this =IF([Expenses $(=(vCurrentYear)-2)] = '0', 'None', 'E') it gives E for all fields, so that I guess the comparison to '0' is not working. Null() is not correct either. How can I solve ?

Thanks in advance