Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
chethim982
Contributor
Contributor

Dimension as value in a set analysis expression

Hi,

I am trying to pass the dimension values of qlik table to a set analysis expression in the same table. 

This needs to be accomplished  in set analysis .

 

Data        
Org_codeOrg_nameSalesOrg_secondary_Code     
1106XYZ1061106     
1102XCV301106     
1106UTY401106     
1106IOP401104     
1101HGF1201102     
1102GYH3301105     
1104FGH1301104     
         
         
         
Requirement:If Org_code and org_secondary_code are equal then report the sales against the Org_code in qlik table.   
 we need to sync the Org_code and Org_secondary_code in set analysis expression. Which is not working.   
 Org_code is an dimension and we need to pass the values of Org_code foreach row  in the set expression.       
Expected ouput:Org_codeOrg_nameSales     
 1106XYZ106+40     
 1102XCV0     
 1101HGF0     
 1104FGH130     
         
3 Replies
sunny_talwar

Why don't you create a flag in the script for this

If(Org_code = Org_secondary_Code, 1, 0) as Flag

and then use this in your expression

Sum({<Flag = {1}>}Sales)

 

dwforest
Specialist II
Specialist II

Set analysis is calculated once per chart (or table). NOT once per row so it is not the appropriate solution in your case.
You could use an If in script as Sunny suggests or in your table as Sales dimension:

If(Org_code = Org_secondary_Code, Sales, 0) 

Not sure if having different names for Org_code 1106 in your example is intentional; if so you'd get unique lines for 1106 XYZ and 1106 UTY

chethim982
Contributor
Contributor
Author

Thanks!. It worked  well with  the flag. I made some changes to script as secondary Org code was coming from  another table. so I merged the secondary code to the table where primary org code  table with the below script.

Load*, If(primaryOrg_code=secondary_org_code,1,0) as flag

resident FACT_Primary;

drop table FACT_primary;

In the chart expression i just used the flag={1} in the set analysis expression Then everything worked well.