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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
seemawadekar
Contributor III
Contributor III

Variable pre aggregates data when used on chart for all values of Dimension.

Hi,

A variable is defined to calculate sum of last 12 months is defined as

SUM({<Monthname=, monthno= {">=$(=$(vRolling12Month))"} * {"<=$(=$(vMonthNo))"}>}sales)

Further the app needs to find out a score for the metric based on the sum of last 12 months. 

It works well when used to find the score in KPI, but when used as a measure in chart it does not slice it by the dimension while calculating the score, sums the value for all the values of dimension and then scores it. 

How can we enforce the dimension on the chart to the variable?

 

Thanks.

Labels (6)
1 Solution

Accepted Solutions
seemawadekar
Contributor III
Contributor III
Author

Thank you all for your responses. 

Calculating the rolling 12 in load script, joining the metric table to it and then using the points from the table on the sheet worked. 

 

View solution in original post

4 Replies
vinieme12
Champion III
Champion III

can you post some snapshots? or a sample app?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
seemawadekar
Contributor III
Contributor III
Author

Hi Vineeth,

Here is the statement 

IF( $(=$(vrolling12Sales))=0,0
,IF($(=$(vrolling12Sales)) <= $(=SUM({<Metric={'Sales'},Level={'1'}>}Max_Score)),MAX({<Metric = {'Sales'},Level={'1'}>}Points)
,IF($(=$(vrolling12Sales)) <= $(=SUM({<Metric={'Sales'},Level={'2'}>}Max_Score)),MAX({<Metric = {'Sales'},Level={'2'}>}Points)
,IF($(=$(vrolling12Sales)) <= $(=SUM({<Metric={'Sales'},Level={'3'}>}Max_Score)),MAX({<Metric = {'Sales'},Level={'3'}>}Points)
,IF($(=$(vrolling12Sales)) <= $(=SUM({<Metric={'Sales'},Level={'4'}>}Max_Score)),MAX({<Metric = {'Sales'},Level={'4'}>}Points)
,IF($(=$(vrolling12Sales)) <= $(=SUM({<Metric={'Sales'},Level={'5'}>}Max_Score)),MAX({<Metric={'Sales'},Level={'5'}>}Points)
))))))

 

Thanks

seemawadekar
Contributor III
Contributor III
Author

If the variable is used by itself, it slices the total for the dimension on the chart, but when used in IF statement or set analysis, it aggregates the measure for all values of the dimension. 

 

seemawadekar
Contributor III
Contributor III
Author

Thank you all for your responses. 

Calculating the rolling 12 in load script, joining the metric table to it and then using the points from the table on the sheet worked.