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: 
geogou1973
Creator
Creator

Instead of IF condition

Hello,

I have the following expression in Add Calculated Dimension

=if(CAPRAR='ST' or CAPRAR='SZ',STICKER,ITEM_ID)

how can i replace this command with another that not contains if command ?

I have problem with performance when i use the command if

Thank you in advance.

10 Replies
sunny_talwar

May be use set analysis instead of calculated dimension

Sum({<ITEM_ID = P({<CAPRAR = {'ST', 'SZ'}>})>}Measure)

geogou1973
Creator
Creator
Author

Hello Sunny,

I have no measures, i use this expression in calculated dimension in order to display

the sticker or the item_id

sunny_talwar

Is this not in a chart? Can you elaborate on how you are using this? May be share a sample?

geogou1973
Creator
Creator
Author

Yes this is in a chart in calculated dimension and in expression i have the command sum(sales)

aarkay29
Specialist
Specialist

Try this,

pick(Match([CAPRAR],'ST','SZ'),[ITEM_ID])

and Supress when value is null

Not applicable

You can't completely replace If condition instead you can use:

=if(Match(CAPRAR,'ST','SZ')>0,STICKER,ITEM_ID)

sunny_talwar

So try this, I guess

Sum({<ITEM_ID = P({<CAPRAR = {'ST', 'SZ'}>})>} sales)

geogou1973
Creator
Creator
Author

I lose the STICKER, i want if the match is true to display STICKER else to display ITEM_ID

Peter_Cammaert
Partner - Champion III
Partner - Champion III

You could create a new field in your data model that contains a different field value depending on the value of CAPRAR. Then it simply becomes a matter of adding this new field as a dimension. The fit depends on the complexity of your data model.

Or you can leave the Calculated Dimension as-is and tackle the performance problems by adding a Calculation condition to empty the object as long as the number of rows is larger than an acceptable maximum. I guess no end user is eager to wade through straight tables containing 10000+ records.