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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
pauledrich
Creator
Creator

Pivot Table (If)

I have a target table with 3 simple expressions with dates as a dimension, for this year there are no targets for Jan & Feb so therefore the Calculation [Results]/[Target] as % is off the scale and I want to display 0 if there is no target or a null.

I have tried to only show a Zero if the Target is 0 which isn't working.

=if(Target>0,Sum([Results]/[Target]),0)

Thanks in advance

P

5 Replies
chiru_thota
Specialist
Specialist

have you tried below ?


=if(sum(Target)>0,Sum([Results]/[Target]),0)

pauledrich
Creator
Creator
Author

Thanks for the reply Chiranjeevi.

I had tried that one also but had a syntax error with bad field names in the second Sum - having checked the target field is null so that's probably the issue?

chiru_thota
Specialist
Specialist

Are you able to resolve the issue ?...If not can you upload some sample data so that we can have a look ?

Not applicable

can you try this:


=if(sum(Target)<=0 or isnull(Target), 0, Sum(Results)/sum(Target))


and also deselect "suppress Zero-Values" on your chart properties

Regards

pauledrich
Creator
Creator
Author

I found the answer which was not related to a null - creating a normal expression with a set modifier of >0 for the field gives me the desired results.

Thanks for the help.