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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

3-way condition in a chart expression definition

I am new to QlikView and I am trying to add a three way condition to a chart expression definition. I would normally do this with a if,then,else. Either that is not allowed in the definition or I can't seem to get the syntax down. Here is the code that I currently have for 2 conditions.

IF ((SLA_RECORD_SORT = '0001' OR SLA_RECORD_SORT = '0002' OR SLA_RECORD_SORT = '0003' OR SLA_RECORD_SORT = '0004')

AND (SLA_LINE='196' OR SLA_LINE='197' OR SLA_LINE='199' OR SLA_LINE='200' OR SLA_LINE='201' OR SLA_LINE='203'

OR SLA_LINE='205'OR SLA_LINE='209' OR SLA_LINE='230')

,Round(Sum (SLA_MTH_TON_00004)),ROUND (Sum (SLA_MTH_TON_00004),.1))

This works fine. If the condition is true it formats the output to the nearest whole number, If it is false it formats the number to 1 decimal which is what I want. The reason for this is because we sell some stuff in cases which are whole numbers and some stuff in tons which need to be carried out to one place to the right of the decimal. The problem is i need to add a format for 2 places to the right of the decimal. In pseudo code I would think it would look something like.

If condition1 then format1

Elseif condition2 then format2

Else format3

Any help or ideas would be appreciated.

4 Replies
Clever_Anjos
Employee
Employee

You can use nesteds if´s

if( cond1, format1, if(cond2, format2, format3))

Not applicable
Author

That did it. Many thanks!

Not applicable
Author

Jim just a sugestion....

i think is really better if you use a set analisys.....more perfomance and more easy to group two IF´s!!!!

Not applicable
Author

set analisys expr....

ROUND(Sum ( {$<SLA_RECORD_SORT={'0001','0002','0003','0004'},SLA_LINE={'196','197','199','200','201','203','205','209','230'}>} SLA_MTH_TON_00004),.1)