Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikdash2000
Contributor II
Contributor II

Set Analysis with Variables

tbm.png

As can be seen in the image above I can filter my variable `vDefects_Production` by the dimension `Conformed Cause Code` to arrive at the values shown; 9k, 3k, etc.

To instead filter using Qlik Sense set analysis I created this code that is a measure in my expression editor:

 

Sum({$<[Conformed Cause Code]={'Vendor'}>} vDefects_Production)

 

The issue is that this code spits out values of `0` for all the categories above (Toothbrush, Monitors, etc.) that previously had values of 9k, 3k, etc.

I imagine there's something wrong with my Qlik syntax? Or is there some other problem with my code?

Labels (2)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

OK

Here is another suggestion. 

Make an adjustment to your variable vDefects_Production  so it looks like this.

sum({$<[Conformed Cause Code] = {$1},[# QN Initiated]={1},[Conformed Location Code]={'Production'}>}[Complaint Quantity])

When calculating the sum for Conformed Cause Code = Vendor then use this expression

=$(vDefects_Production(Vendor))

View solution in original post

5 Replies
Vegar
MVP
MVP

What is the content of your vDefects_Production variable? Is it a field name or an expression?

Vegar
MVP
MVP

If the variable vDefects_Production is an aggregating expression such as SUM(DefectProducts) then you can try something like this.

=sum( {<[Conformed Cause Code] = {'Vendor'}>}  aggr($(='$(=vDefects_Production)'), [Conformed Cause Code] ))

qlikdash2000
Contributor II
Contributor II
Author

The definition of the variable is:

 

sum({$<[# QN Initiated]={1},[Conformed Location Code]={'Production'}>}[Complaint Quantity])

 

I did attempt to use your other solution but got the same results, everything was `0`. Thank you for the attempt. Any other ideas?

 

Vegar
MVP
MVP

OK

Here is another suggestion. 

Make an adjustment to your variable vDefects_Production  so it looks like this.

sum({$<[Conformed Cause Code] = {$1},[# QN Initiated]={1},[Conformed Location Code]={'Production'}>}[Complaint Quantity])

When calculating the sum for Conformed Cause Code = Vendor then use this expression

=$(vDefects_Production(Vendor))

qlikdash2000
Contributor II
Contributor II
Author

Instead of messing around with variables I just am going to use this entire expression as my solution:

 

sum({$<[# QN Initiated]={1},[Conformed Location Code]={'Production'},[Conformed Cause Code]={'Vendor'}>}[Complaint Quantity])

 

I'd try out your solution but don't have the permission level in Qlik Sense Cloud to create/edit variables. I'll assume you're correct though and "accept as solution". Thank you.