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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Nested If Statement

Can someone please help  me with this formula?  Something is wrong with the conditional argument because the final false argument is always what displays.  I have tested this by commenting out line 4, which results in a chart that says no data to display.

=IF($(vAggLevel) = 'Total Amount',

      MONEY(SUM({$<[USD:Approved]={">$(PopHighDollar)"}>} [USD:Approved])),

      IF($(vAggLevel) = 'Transaction Count',

           NUM(COUNT({$<[USD:Approved]={">$(PopHighDollar)"}>} [Report_Entry]),'##,###'),

           MONEY(SUM({$<[USD:Approved]={">$(PopHighDollar)"}>} [USD:Approved]))

      )

)

vAggLevel is defined as

     GetFieldSelections(Level)

The Level field only has 2 values "Total Amount" and "Transaction Count"

I have used the same formula on a different chart and it works fine.  This only difference is the True statement.  In the chart that works I have a standard SUM or COUNT, where as in this one I am using set analysis.

I also have a text box that dispays vAggLevel to make sure the variable is getting populated correctly.

Any suggestions?

6 Replies
Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

What does this gives you in return

vAggLevel is defined as

     GetFieldSelections(Level)?

sasiparupudi1
Master III
Master III

since you only have 2 values in the variable,one if should be sufficient

IF($(vAggLevel) = 'Transaction Count', NUM(COUNT({$<[USD:Approved]={">$(PopHighDollar)"}>} [Report_Entry]),'##,###'),

                                        MONEY(SUM({$<[USD:Approved]={">$(PopHighDollar)"}>} [USD:Approved]))

hth

Sasi

Michiel_QV_Fan
Specialist
Specialist

Jessica,

You can use Stefan Walthers nested if tool here: http://www.qlikblog.at/464/tool-creating-nested-ifstatements/

Not applicable
Author

Sorry to bring up an old thread, but I am also having the same issue.

I'm using an IF statement on a chart which changes its dimension in respect of a variable button. The variable button allows the field on the chart to change from CalendarYear, CalendarYearQtr, and MonthYear. The IF statement works fine when it's not nested. For example:

IF($(vDateDisplay) = CalendarYear, Example1, Example2)

However, once the If statement is nested it only displays the false argument. For example:

IF($(vDateDisplay) = CalendarYear, Example 1,

IF($(vDateDisplay) = CalendarYearQtr, Example2,

Example 3))

If this a known issue in Qlik Sense?

PradeepReddy
Specialist II
Specialist II

can u provide the sample app?

Not applicable
Author

I'm not able to sorry due to sensitive data. And it's a Qlik Sense app, only realised that this was a Qlik View thread sorry.