Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
uzername
Contributor III
Contributor III

QlikSense set analysis behaviour - scope problem

I have a set analysis as below:

vYear : Year(today() )

vDayOfYear: daynumberofyear(today())

AccidentsTYTD: Count(Distinct {<Year, Year={'$(vYear)'}, DayOfYear={'<$(vDayOfYear)'} >} AccidentID)

If I enter this as master item it behaves OK against other dimensions, but if it is set via load script (from a variable sheet) it calculates incorrectly against the dimension. My Question, why do master item and variable behave differently, and how can it be fixed?

See an example below:

accSetAnalysis.JPG

The first column is entering expression directory in the table measures,

second col is same expression already entered as master item,

last column is calling a variable which is populated at load time using  LET $(vName) = '=' & lookup(...)

vardef.JPG

Thanks.

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hi

when you have the '=' sign in the variable function

then qlik will calculate the expression and the variable is actually representing

the result of the expression on the whole data set

you just need to remove the '=' from your variable definition and it'll work

View solution in original post

2 Replies
martinpohl
Partner - Master
Partner - Master

Hello,

when using < > <= or >= you need quotations in set analysis

use

AccidentsTYTD: Count(Distinct {<Year, Year={'$(vYear)'}, DayOfYear={"<$(vDayOfYear)"} >} AccidentID)

(I changed ' to " in the DayOfYear parameter).

Regards

lironbaram
Partner - Master III
Partner - Master III

hi

when you have the '=' sign in the variable function

then qlik will calculate the expression and the variable is actually representing

the result of the expression on the whole data set

you just need to remove the '=' from your variable definition and it'll work