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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Ansh
Contributor
Contributor

Nullify selection values in if statement

Hi,

My requirement is to nullify the selection in if statement.

I have year as a filter and I want to nullify its value even if particular year is selected and this has to  be done in an if statement.

My expression is :
if(product='Cards',sum({<year=>}sales),

if(product='MF',sum({<year=>}gross_sales))   

If I am selecting year =2019, I need to get all years of data but I am getting only 2019 data. If I use   sum({<year=>}sales) without using If its is working as expected.

Please suggest.

Thanks                        

Labels (1)
1 Solution

Accepted Solutions
agigliotti
MVP
MVP

maybe this:

=sum( {<year=>} if( product='Cards', sales,
if( product='MF', gross_sales )
)
)

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it

View solution in original post

2 Replies
agigliotti
MVP
MVP

maybe this:

=sum( {<year=>} if( product='Cards', sales,
if( product='MF', gross_sales )
)
)

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
Ansh
Contributor
Contributor
Author

It works but I have few more fields in the set analysis which are different in both the cases. 

So in actual it is 

=if( product='Cards', sum({<country='China', code='106',forecast=$(vmax_cycle)>}sales),
if( product='MF', sum({<country='SGH', code='160',forecast=$(vmax_cycle)>}gross_sales )
)
)

Please suggest