Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER 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
Partner

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
Partner

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
Partner

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