Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!!
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)
hmm yes i tried that before and it didnt work... i do not know why
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)