Qlik Community

Community Corner

Discussion board for questions about the Qlik Community, its features, sharing information, general discussions and even some fun. This is for both new and longtime community members. Everyone is welcome!

Ansh
New 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
Partner
Partner

Re: Nullify selection values in if statement

maybe this:

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

2 Replies
Partner
Partner

Re: Nullify selection values in if statement

maybe this:

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

Ansh
New Contributor

Re: Nullify selection values in if statement

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