Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

conditionally replace 0 with '-' without breaking set analysis

Using set analysis to limit some records, but I am having trouble including conditional logic. 

The set analysis results in a 0 sometimes, I need this 0 to be replaced with a '-'.  If I wrap an if statement around the set analysis I can no longer limit the records, because the set analysis is ignored.  How do I replace 0 with '-' in a chart and use set analysis?

5 Replies
MK_QSL
MVP
MVP

You can use something like below

IF(YourExpression = 0,'-',YourExpression)

Not applicable
Author

doesn't work because the if will return something on every record and we need the set analysis to be respected

sunny_talwar

You need to provide more details if you think this isn't going to work. Because from the looks of it, I think it should work, but you might be right. Before you provide more details it would be hard to troubleshoot.

Best,

Sunny

Not applicable
Author

yes, something more complex must be going on ... in my simple examples it does seem to work:

if(

flag = 0,

'-',

sum({<flag={1}>}data)

)

Let me put together my exact example.

MK_QSL
MVP
MVP

Try

if(sum({<flag={1}>}data) = 0,'-',sum({<flag={1}>}data))