Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
mishraamit2485
Creator
Creator

Set Analysis

Hi All,

I need one help here in writing one set analysis expression, I have the same condition in (if function) but i want to rewrite it using set.

here is the function

COUNT(DISTINCT if(isnull(Mother_Board)=FALSE(),TotalNoOfLaptops)).

2nd Question, is it possible for any definition if i write numerator using Set and denominator using if function, will this give me correct result or I have to use set analysis for both nume and deno or if function for both numerator and denominator.

8 Replies
sunilkumarqv
Specialist II
Specialist II

try like this

=If(Count(DISTINCT {<isnull(Mother_Board)={'FALSE()'}>}1),TotalNoOfLaptops)

mishraamit2485
Creator
Creator
Author

Thanks for your reply but its not working, and why are we using all the condition inside the if...

MK_QSL
MVP
MVP

COUNT(DISTINCT if(isnull(Mother_Board)=FALSE(),TotalNoOfLaptops))

=

COUNT({$<Mother_Board = {'*'}>}DISTINCT TotalNoOfLaotops)

PrashantSangle

Hi,

You need some field comapre in Set analysis

Like If you have Line wise data,

Then you can try like this,

Count({<Line_Id={"=not isNull(Mother_Board)"}>}TotalNoOfLaptops)

Or

In you if statement

Try this,

COUNT(DISTINCT if(not isnull(Mother_Board),TotalNoOfLaptops)).

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
mishraamit2485
Creator
Creator
Author

HI Manish, looks like it is working fine not able to test it as do not have the data set.

Could please explain me how we are using {'*'}

MK_QSL
MVP
MVP

{'*'} will use only non null value Mother_Board

mishraamit2485
Creator
Creator
Author

Thanks manishkachhia tested it it's working fine   , just by curiosity i'm asking what if I have to see only the null value instead of non null.

Is there any link you would suggest where I can refer for such kind of queries.

MK_QSL
MVP
MVP

Create a Flag in your script just below Mother_Board Field like below...

If(IsNull(Mother_Board) or Len(Trim(Replace(Mother_Board,'-','')))=0,1,0) as Monther_Board_Null_Flag

Now you can use as below

For Non Null

COUNT({$<Mother_Board = {'*'}>}DISTINCT TotalNoOfLaotops)

or

COUNT({$<Mother_Board_Flag = {0}>}DISTINCT TotalNoOfLaotops)

Try {0} or {'0'} or {"0"} all....


For Null

COUNT({$<Mother_Board_Flag = {'1'}>}DISTINCT TotalNoOfLaotops)