Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Billy_u
Creator
Creator

VARIABLE IN SET ANALYSIS

Hi everyone,

i try in qlik sense a set analysis with a variable, i will want calcolate a misure of year and year preview, but make me the total:

 

sum({<ANNO = {$(=max(ANNO))}},=$(=$(varaiblemesaure)))

 

With this result a total of all year...

 

thx every one,

hi,

Billy

Labels (2)
9 Replies
Anil_Babu_Samineni
MVP
MVP

What is the "varaiblemesaure"?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Billy_u
Creator
Creator
Author

is a variable / container, where there is an expression whose result is a score

Anil_Babu_Samineni
MVP
MVP

If that variable returns 1000, Simply use 

sum({<ANNO = {"$(=max(ANNO))"}>} variablename)

Or

sum({<ANNO = {"$(=max(ANNO))"}>} $(variablename))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Billy_u
Creator
Creator
Author

the problem is that it makes me the total sum, instead I would like the data of the year max or of the previous year, to compare them

Anil_Babu_Samineni
MVP
MVP

The same question you already asked in the opening message itself. What is variable you defined? Is this something ANNO = {"$(=max(ANNO))"} calculating the Max Year? If not, What your goal here?

If you need compare analysis, Create Bar chart with Dimension as ANNO and Expression

Sum({<ANNO = {">=$(=AddYears(Max(ANNO),-1))<=$(=Max(ANNO))"}>} variablename) 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Billy_u
Creator
Creator
Author

I would like to make the difference between the (variable) score of the current and previous year variable

Anil_Babu_Samineni
MVP
MVP

Can u please upload an example to test?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Billy_u
Creator
Creator
Author

the result if i will want it's:

something similar...

($(score(MaxYear)) - $(score(MaxYear-1))) / $(score(MaxYear-1))

Anil_Babu_Samineni
MVP
MVP

Seems like this is like Parameter query in analysis? I believe you already have variable like score in that you want by pass the all values with Latest and Latest-1? 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful