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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Simple Dimension Expression Issue

So this is probably a really easy question to answer, but didn't find anything in a search:

I have a List Box that splits my data into two categories - Y and N.

I want to put in a bar graph that shows both the Yes and the No data. I thought an if() statement would be appropriate but can't seem to get the correct expression that QV would like. I think it has something to do with my input after the '=' sign...

=if(PuttableF=N, 'No',if(PuttableF=Y, 'Yes','Neither'))



Labels (1)
1 Solution

Accepted Solutions
Miguel_Angel_Baeyens
Support
Support

Hello,

If PuttableF is a field that contains "Y" or "N", then use it as dimension, and do a Count(Field) where Field is any field related to those Y or N.

Anyway, check some missing single quotes in your expression:

=if(PuttableF = 'N', 'No', if(PuttableF = 'Y', 'Yes', 'Neither'))


Note that conditional based calculated dimensions will take a lot of time to render, so avoid them whenever possible.

Hope this helps.

View solution in original post

3 Replies
Miguel_Angel_Baeyens
Support
Support

Hello,

If PuttableF is a field that contains "Y" or "N", then use it as dimension, and do a Count(Field) where Field is any field related to those Y or N.

Anyway, check some missing single quotes in your expression:

=if(PuttableF = 'N', 'No', if(PuttableF = 'Y', 'Yes', 'Neither'))


Note that conditional based calculated dimensions will take a lot of time to render, so avoid them whenever possible.

Hope this helps.

Not applicable
Author

Thanks Miguel, the single quotes worked. I have a pretty nice sized if() statement dimension already in the chart (and noticed the difference in time it took to save/open the file). But doesn't the count() function just give the number of Y or N values and not the values themselves? I need to display the actual values too.

Miguel_Angel_Baeyens
Support
Support

Well, it depends on how you have built your data model.

To get the count of fields with Y or N, you can use

Count({< PuttableF = {'Y'} >} ID)


For "Neither", you can try (although I don't know how it will work)

Count({1 - < PuttableF = {'Y', 'N'} >} ID)


Hope this helps