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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
RobinTMavhu
Contributor III
Contributor III

QLIK EXPRESSION

PLEASE HELP: My expression is only working for a table but not a KPI. The idea is add up closing stock per material from various stores(for the latest date) and then divide by maximum stock level (AVERAGE_STOCK*6). The expression and respective screenshots as per below:

=(
Sum(
Aggr(
If(TO_DATE = Max(TOTAL TO_DATE), Sum(CLOSING_STOCK)),
TO_DATE,
MATERIAL
)
)
)
/
(AVERAGE_STOCK*6)

RobinTMavhu_1-1757067456661.pngRobinTMavhu_2-1757067761150.png

 

Labels (2)
1 Solution

Accepted Solutions
FedericoDellAcqua
Creator II
Creator II

Ok, and why not including the /(AVERAGE_STOCK*6) inside the aggregation?

View solution in original post

4 Replies
FedericoDellAcqua
Creator II
Creator II

What if you remove the MATERIAL from the aggregation inside the KPI? 

RobinTMavhu
Contributor III
Contributor III
Author

No luck still.

FedericoDellAcqua
Creator II
Creator II

Ok, and why not including the /(AVERAGE_STOCK*6) inside the aggregation?

RobinTMavhu
Contributor III
Contributor III
Author

Thank you so much probably there is bit of rounding issues but im going with your suggestion. 

AVG(
Aggr(
If(TO_DATE = Max(TOTAL TO_DATE), Sum(CLOSING_STOCK) / (AVERAGE_STOCK*6)),
TO_DATE,
MATERIAL
)
)

RobinTMavhu_0-1757081192860.png