Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

datashaw
New Contributor III

If condition within Set Analysis expression

Can you please help to me to write the below if condition inside the set analysis please

Set Analysis Expression =

Count({< STATUS ={'Rejected'}, TYPE ={'RTP'}>}  Items)

IF Condition:

=if( Switcher = Payer,  Switcher ,null()).

on above if Condition all are column names

Basically I want to show this on the KPI in Qlik Sense.

I appreciate if you could help me to resolve the issue.

 

 

Labels (1)
2 Solutions

Accepted Solutions
laurischarf
Contributor III

Re: If condition within Set Analysis expression

You can't write IF inside of set analysis, only outside:

If(Switcher=Payer, Count({<STATUS ={'Rejected'}, TYPE ={'RTP'}>}  Items))

Highlighted
datashaw
New Contributor III

Re: If condition within Set Analysis expression

I found the answer... Thanks for the help 🙂

Count({<STATUS ={'Rejected'}, TYPE ={'RTP'}>} If(Switcher=Payer, Items))
8 Replies
laurischarf
Contributor III

Re: If condition within Set Analysis expression

Are you using IndirectPayer as a dimension in your KPI? Or are you limiting the Items that get counted?

datashaw
New Contributor III

Re: If condition within Set Analysis expression

This is just a KPI  numbers on the dashboard there no Dimension. 

 

*Just limiting the items to get counted

Please correct my set analysis part with if condition 

Count({<       '*IF condition here'  ,             STATUS ={'Rejected'}, TYPE ={'RTP'}>}  Items)

=if( Switcher = Payer,  Switcher ) 

 

 

Field names:

Switcher = Santander, Barclays, City, Lloyds, HSBC...etc 

Payer = HSBC, Habib, Natwest, City, TSB, Santander.... etc,

laurischarf
Contributor III

Re: If condition within Set Analysis expression

You can't write IF inside of set analysis, only outside:

If(Switcher=Payer, Count({<STATUS ={'Rejected'}, TYPE ={'RTP'}>}  Items))

datashaw
New Contributor III

Re: If condition within Set Analysis expression

Thanks for the reply Laurischarf, I would expect the result would be 3-5 digit Number, but it does not show anything just an '-' on the KPI
Highlighted
datashaw
New Contributor III

Re: If condition within Set Analysis expression

I found the answer... Thanks for the help 🙂

Count({<STATUS ={'Rejected'}, TYPE ={'RTP'}>} If(Switcher=Payer, Items))
laurischarf
Contributor III

Re: If condition within Set Analysis expression

Of course! Sorry for my error. Glad you figured it out.
datashaw
New Contributor III

Re: If condition within Set Analysis expression

But in the if statement how do i avoid nulls
is that something like this..? please correct

Count({<STATUS ={'Rejected'}, TYPE ={'RTP'}>} If(Switcher=Payer -= "=Null()" , Items))
laurischarf
Contributor III

Re: If condition within Set Analysis expression

No, you have to put all set analysis statements between { }. Are you getting Items where Switcher and Payer are Null? I would expect the If statement to remove them, because Qlik doesn't consider Null a value, so when Switcher and Payer are Null, they are not equal. They are nothing.

Still, you can make sure to get only values using a wildcard, like this:

Count({<STATUS ={'Rejected'}, TYPE ={'RTP'}, Switcher={'*'}>} If(Switcher=Payer, Items))

Or do it in the If, but they say performance is better with set analysis.

Count({<STATUS ={'Rejected'}, TYPE ={'RTP'}>} If(Switcher=Payer and Len(Switcher)>0, Items))