Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
kailafisher
Contributor
Contributor

dynamic vs non-dymanic set analysis: making something not change with filters

hello,

i have the following expression:

round(((SUM({<Product={"=sum(TotalCost)>=$(=max(aggr(sum(TotalCost),Product),3))"}>}TotalCost)) / sum(TotalCost))*100, .01) & '% of Total Cost'

right now what its doing is taking the top 3 highest cost products and finding what percentage of total cost that they collectivley occupy. I need to make the sum(TotalCost) at the end "not dynamic" so when the filters are in place my function will still divide by the whole total cost of every product in my database.

i have tried a combination of ALL, TOTAL, {1} but nothing is working please help!!

Labels (5)
3 Replies
Vegar
MVP
MVP

The expression

sum({1}TotalCost) should give you the total you are looking for. If you are using it in a object with dimensions you might want to puy in a total as well. Like this : sum({1}TOTAL TotalCost) 

kailafisher
Contributor
Contributor
Author

hmm yes i tried that before and it didnt work... i do not know why

sunny_talwar

So, to be clear, you are getting the right number from your numerator expression?

Sum({<Product ={"=Sum(TotalCost) >= $(=Max(Aggr(Sum(TotalCost), Product), 3))"}>} TotalCost)

you only have issues with your denominator only?

Sum(TotalCost)

Or do you really want this for numerator

Sum({<Product ={"=Sum(TotalCost) >= $(=Max({1} Aggr(Sum({1} TotalCost), Product), 3))"}>} TotalCost)

and this for denominator

Sum({1} TotalCost)