Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Is Null in Set Analysis

Help.   I am just trying to convert the If/Then SUM expression below, that works fine but is slow, to Set Analysis.   I don't know how to get the IsNull to work in Set Analysis despite searching forums.   Seems like this should be a simple modification.  

Can anyone please assist??

Thanks MUCH.

Original If/Then that works fine:

= sum(if(IsNull(TCW) and TCNB=0,TCAmt))


Trying to convert to Set Analysis, have tried this one and many others with no luck. 
:


=sum({<TCNB={0}, $(TCW=("")"} TCAmt))

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I assume this will work:

=sum({($ -<TCW={'*'}>) * <TCNB={'0'}>} TCAmt)

Regards,

Michael

View solution in original post

13 Replies
MayilVahanan

Hi

Try like this,

=Sum({<TCNB ={0],TCW={''}>}TCAmt)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

This resulted in no data.   So no luck.    

MayilVahanan

Hi,

Try this

=Sum({<TCNB ={0],TCW-={*}>}TCAmt)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Anonymous
Not applicable
Author

I assume this will work:

=sum({($ -<TCW={'*'}>) * <TCNB={'0'}>} TCAmt)

Regards,

Michael

Not applicable
Author

Well this one seems to be close, the others are not working at all.    (name blanked out)   It returns the correct SUM in total, but when drilling into details in all cases the If/Then returns data for the Name, and in SOME cases the Set Analysis returns data as well.  But in SOME cases it returns NULL (see below for side by side example).  

You can see the TCW and TCNB values are 0 and NULL, as they should be.   Just can't figure out why a bunch of the names are returning NULL, however working fine with If/Then.  

Any other tweaks that might solve this?  Thank you again.

Capture.PNG

Not applicable
Author

Mayil is there a typo in the formula?   QV is asking for a comma for some reason and giving a syntax error when i try this expression.

Thank you.

MayilVahanan

Hi

Its a bug in expression validation ,ignore it. And check the result.. Expression is fine.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

OK, i tried it

=Sum({<TCNB ={0],TCW-={*}>}TCAmt)

I think the square bracket after the 0 should be curly bracket right?   Regardless i tried it both ways and recieved 0 for all records.  

Anonymous
Not applicable
Author

Set analysis evaluates data over the complete data set, it "doesn't know" about the chart dimensions.  That means that set analysis modifiers can be used in a chart expression only if they're applicable to any row regardless chart dimensions.
Apparently it is not the case in your example, hence you get correct result in total but wrong per dimension.  Using "if" is the reliable approach here.

Regards,
Michael