Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
risabhroy_03
Partner - Creator II
Partner - Creator II

Set Analysis

I have a measure named Quantity which has the following expression

if([Table Source]=('WHUIL200'),Sum({<[Invoice_Date_GMT_Updated] = {"$(vLastmonthdate)"}>} Quantity)
,if([Table Source]=('TIUIL962'),Sum({<[As_On_Date_GMT_Updated] = {"$(vLastmonthdate)"}>} Quantity)
,if([Table Source]=('FG GIT'),Sum(Quantity)
,if([Table Source]=('WHINH301') and ("T$LTRL"=1) and ((len(trim("T$BOLA"))>0)),Sum({<[Ship_Date_GMT_Updated]={"<=$(vLastmonthdate)"},[Arrive_Date_GMT_Updated]={">$(vLastmonthdate)"}>} Quantity)
,if([Table Source]=('WHINH301') and ("T$LTRL"=2) and ((len(trim("T$BOLA"))>0)),Sum({<[Ship_Date_GMT_Updated]={"<=$(vLastmonthdate)"}>} Quantity))))))

 

I want to put all the if conditions inside the set analysis so that my value of quantity does not get hampered.

 

Please help.

1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

You can union sets, maybe that is what you are looking for:

sum({

<[Table Source]={'WHUIL200'},[Invoice_Date_GMT_Updated] = {"$(vLastmonthdate)"}>

+

<[Table Source]={'TIUIL962'},[As_On_Date_GMT_Updated] = {"$(vLastmonthdate)"}>

+

<[Table Source]={'FG GIT'}>

+

<... finish your sets ...>

} Quantity)

View solution in original post

3 Replies
vinieme12
Champion III
Champion III

You cannot put conditional calculations based on your dimension value in set analysis, that is not what set analysis is for

I would suggest you simplify your data model 

Go thru the below

https://community.qlik.com/t5/Qlik-Design-Blog/Canonical-Date/ba-p/1463578

 

you can use Pick & Match to 'somewhat' simplify this

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
stevejoyce
Specialist II
Specialist II

You can union sets, maybe that is what you are looking for:

sum({

<[Table Source]={'WHUIL200'},[Invoice_Date_GMT_Updated] = {"$(vLastmonthdate)"}>

+

<[Table Source]={'TIUIL962'},[As_On_Date_GMT_Updated] = {"$(vLastmonthdate)"}>

+

<[Table Source]={'FG GIT'}>

+

<... finish your sets ...>

} Quantity)

risabhroy_03
Partner - Creator II
Partner - Creator II
Author

I did this 

Sum({<[Table Source]={'WHINH301'},[Flag]={'0'},[T$LTRL]={'1'},[Ship_Date_GMT_Updated]={"<=$(vLastmonthdate)"},[Arrive_Date_GMT_Updated]={">$(vLastmonthdate)"}>} Quantity)
+
Sum({<[Table Source]={'WHINH301'},[Flag]={'0'},[T$LTRL]={'2'},[Ship_Date_GMT_Updated]={"<=$(vLastmonthdate)"}>} Quantity)
+
Sum({<[Table Source]={'WHUIL200'},[Invoice_Date_GMT_Updated]={"$(vLastmonthdate)"}>} Quantity)
+
Sum({<[Table Source]={'TIUIL962'},[As_On_Date_GMT_Updated]={"$(vLastmonthdate)"}>} Quantity)
+
Sum({<[Table Source]={'FG GIT'}>} Quantity)

 

the total value is also coming correct but when I am filtering my table by clicking any record my quantity remains same, but it should change as per the filter.

Plzz help.