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: 
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
Partner - Champion
Partner - Champion

maybe this:

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

View solution in original post

2 Replies
agigliotti
Partner - Champion
Partner - Champion

maybe this:

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

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