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: 
evansabres
Specialist
Specialist

If statement for dimension, exclude fields, handle nulls

I have a field, 'Group' that I am using as a dimension. I am excluding certain values from the dimension, such as 'ABC', 'DEF', by =IF(Not Match(Group, 'ABC', 'DEF), Group) however, would there be a way to introduce more logic to rename fields that are blank or null?

11 Replies
sunny_talwar

Something like this?

=If(Len(Trim(Group)) = 0, 'BLANK',
 If(Not Match(Group, 'ABC', 'DEF), Group))
evansabres
Specialist
Specialist
Author

The structure of the calculated dimension works, however when I apply to my chart, the value still returns as   '-     '

sunny_talwar

Is there a dash before the blank space?

evansabres
Specialist
Specialist
Author

My reply above is how my chart is displaying the row with the null or blank values:

 

'-   '   I was just attempting to demonstrate that the dash is on the left of the cell,if that is of any significance.

sunny_talwar

Can you show a screenshot to show the issue?

evansabres
Specialist
Specialist
Author

 
sunny_talwar

I think this null is related to if condition not Match(Group, 'ABC', ...)... in order to get rid of this, uncheck 'Show zero value' under your dimension

evansabres
Specialist
Specialist
Author

I want to show the blank field as it is important to the data in this application. I want to rename the blank field something like 'No Preference'

sunny_talwar

Try this

=If(Not Match(Group, 'ABC', 'DEF), Group, 'No Preference')