Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

What's wrong with my if syntax? :(

Hi,

I have a table of account information (from Salesforce) in QV. Each account has an Account ID and Account Status (Customer, Lost Customer, Work in Progress, etc).

I wanted to create an expression that would return 1 if an account was in Customer status and 0 else. This is the expression I used:

if(([Account Status]='Customer'),1,0)

for some reason, when I create a straight table with Account ID as dimension and the expression above as the expression, QV would only show the Accounts with 1 (i.e. the customers), and not all the others. This persists of course after hitting clear.

What am I doing wrong?

Thanks!

Al

1 Solution

Accepted Solutions
Not applicable
Author

Go to Presentation tab in the stright table -> Uncheck Suppress zero values and click Ok, You would see the results correctly.

View solution in original post

9 Replies
Not applicable
Author

Hi Al,

may be you can check what QV does about missing or zero values. (hidding ?)

best regards

Chris

Not applicable
Author

Try this:
If([Account Status]='Customer',1,0)

Not applicable
Author

Go to Presentation tab in the stright table -> Uncheck Suppress zero values and click Ok, You would see the results correctly.

Not applicable
Author

so basic, so simple, how embarassing thanks a lot!

Not applicable
Author

Hi,

Try to add another expression like "Only({1} [Account ID])" and hide this column from Presentation tab.

Not applicable
Author

that works as well (along with unchecking the suppress zero values box).

What's the difference? Which is better?

thanks

jagan
Luminary Alumni
Luminary Alumni

Hi,

Qlikview suppresses zero values, if you want then

Chart Properties -> Presentation -> Uncheck Supress zero values

or use this expression

If([Account Status]='Customer','Customer', 'Non Customer')


Hope this helps you.


Regards,

Jagan.

Not applicable
Author

yup, that's it! Thanks a lot

Not applicable
Author

yes, that's it. I don't have any more 'helpful answer' stars to give, sorry