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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparison with zero not working - Dimension in Pivot Table

In some Pivot Table, I have one calculated dimension based on value for an expression.

=IF([Expenses $(=(vCurrentYear)-2)] = '0', 'None', 'E')

with Expenses $(=(vCurrentYear)-2) the Label for an expression in the Pivot Table.

It gives E for all fields, so that I guess the comparison to '0' is not working (it should sometimes give None). Null() is not correct either.

How can I solve ?

5 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Unfortunately you cannot use a label referencing a variable in expressions. so you must repeat the code in the other expression ...

Not applicable
Author

Thanks

If i repeat the code, like this

=IF(Sum({<[Fiscal Year]={$(=(vCurrentYear)-2)}>}[Sales Amount]) = '0', 'None', 'E')

this is not working (error in calculating expression). How is syntax wrong ?

sasikanth
Master
Master

Try some thing like this

=IF(isNull(Sum({<[Fiscal Year]={$(=(vCurrentYear)-2)}>}[Sales Amount])),'None','E')

Not applicable
Author

try this

=IF(Sum({<[Fiscal Year]={$(=(vCurrentYear)-2)}>}[Sales Amount]) = 0, 'None', 'E')


Thank you

Vardhan

Not applicable
Author

both give error in calculated dimension

for the expression itself seems to be =IF($(=Sum({<[Fiscal Year]={$(=(vCurrentYear)-2)}>}[Sales Amount])) = 0, 'None',$(=(vCurrentYear-2)) )  but comparison with zero is still not working.

any idea?