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: 
stantrolav
Partner - Creator II
Partner - Creator II

Replacement IF condition by set analysis

I got an expression with IF condition. It work's too slow. I want to change it to set analysis,

1. Expression with IF (it works fine):

sum(aggr( count (DISTINCT  if([Month] = [DistMonth],

  [CholdingID])),Fil, [MY],[CholdingID]))

2. My expression:

count(Aggr(sum(

{1<[Month] = {"=[Month]=[DistMonth]"}>}

1),Fil,[Month],[CholdingID]))

The main trouble is in marking multiply values in [DistMonth]. When i use first expression everything works fine. But with second expression I cant chose  multiply values. Second expression works with single value of [DistMonth] only. When i try to get two values of [DistMonth] it dont show me two values in dimension.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Set analysis calculates one set per chart, not per row. That means that comparing fields on the same row probably doesn't do what you expect. I've tried to explain what happens in this document: set_analysis_intra-record.qvw. I hope this helps.


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Set analysis calculates one set per chart, not per row. That means that comparing fields on the same row probably doesn't do what you expect. I've tried to explain what happens in this document: set_analysis_intra-record.qvw. I hope this helps.


talk is cheap, supply exceeds demand
christian77
Partner - Specialist
Partner - Specialist

Hi:

I understand that your problem is to set a variable with several months on it.

This is what I usually do:

Imagine I have selected 3 months Jan, Feb, Jun. To pick them up in a var,

vMonth   concat(distinct Month,’”’) work out the quotations and it is yours.

Then in your set analysis Month={$('vMonth)'}

I recomend you to use set analysis instead of ifs clauses.

Salutes.

stantrolav
Partner - Creator II
Partner - Creator II
Author

Thanks, G.