Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If Then Else with Sum Not Working

Help, I am new to Qlikview and ready to go crazy.

I have SQL and .NET experience and I am trying to do something that is so easy using those tools.

In my QVW document, I have a chart, and within that chart I am trying to build an Expression.

Here is the simple English:

If the rProcedure Class Code field has a value of 'MR', then sum the numeric value of the rUnits field.

Here is the QV syntax.

If([rProcedure Class Code])='MR', Sum(rUnits))

I get an Expression OK, but the If Then Else seems to have no effect on my chart.

If I do not do the If Then Else, and simply sum rUnits, I get desired results.

I also tried doing an UPPER and TRIM, in case there were any extra characters or mixed case characters, with no success. And I checked the table for the existance of 'MR' and it was there. Seems so simple. What am I doing wrong?

Thanks,

Bob

4 Replies
jykang0638
Partner - Contributor III
Partner - Contributor III

Hi Bob,


You should use like this:

Sum(If([rProcedure Class Code]='MR', rUnits))
or
Sum({<[rProcedure Class Code]={'MR'}>} rUnits)


The second expression is using set analysis syntax.
It's very powerful functionality and useful.
You can refer it in the Help menu or reference manual.


I hope it will help you.

Steve Kang.

jagan
Luminary Alumni
Luminary Alumni

Hi,

The below expression works

Sum(If([rProcedure Class Code]='MR', rUnits))

or

Sum({<[rProcedure Class Code]={'MR'}>} rUnits)

If not, attach sample data.  This helps in finding the solution.

Regards,

Jagan.

Not applicable
Author

Thanks! This worked fine .....

I just posted another question about automatically opening an external web page in a QV sheet, that is, the user does not click a link, rather, when entering the page, the web page "self deploys" to the sheet. Do you know anything about that?

Thanks again,

Bob

Not applicable
Author

Hi, this worked. Thanks for your help! .... Bob