Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
william_fu
Creator II
Creator II

Weighted average measure not changing based on dimension

I have this weighted average formula, and it gives me the same values for whichever dimension I pivot it by:

Sum({$<[LLR.PdCorrente]-={100}>} Total [LLR.PdCorrente] * Aggr (Sum({$<[LLR.PdCorrente]-={100}>} Saldo), [LLR.PdCorrente])) / Sum({$<[LLR.PdCorrente]-={100}>} Total Aggr(Sum({$<[LLR.PdCorrente]-={100}>} Saldo), [LLR.PdCorrente]))

However if I select a specific member of a dimension, it calculates correctly.

Any ideas?

1 Solution

Accepted Solutions
william_fu
Creator II
Creator II
Author

Hi Sunny,

This simpler measure is working just fine; apparently there was no need for Aggr/Total

Sum({$<[LLR.PdCorrente]-={100}>} [LLR.PdCorrente] *  Saldo)

/

Sum({$<[LLR.PdCorrente]-={100}>} Saldo)

Thanks for your help

View solution in original post

6 Replies
sunny_talwar

Is this saved in a variable? If it is, then you might have used an equal sign when you save the variable definition.... try to get rid of the equal sign and see if that helps..... (all hypothetical, but I think that might be the issue)

william_fu
Creator II
Creator II
Author

It is saved as a variable, but there's no equal sign preceding it.

sunny_talwar

May be try to remove these TOTAL key word from here

Sum({$<[LLR.PdCorrente]-={100}>} Total [LLR.PdCorrente] * Aggr (Sum({$<[LLR.PdCorrente]-={100}>} Saldo), [LLR.PdCorrente])) / Sum({$<[LLR.PdCorrente]-={100}>} Total Aggr(Sum({$<[LLR.PdCorrente]-={100}>} Saldo), [LLR.PdCorrente]))

And try this:

Sum({$<[LLR.PdCorrente]-={100}>} [LLR.PdCorrente] * Aggr (Sum({$<[LLR.PdCorrente]-={100}>} Saldo), [LLR.PdCorrente])) / Sum({$<[LLR.PdCorrente]-={100}>} Aggr(Sum({$<[LLR.PdCorrente]-={100}>} Saldo), [LLR.PdCorrente]))

william_fu
Creator II
Creator II
Author

Hi Sunny,

I tried your suggestion and got an even stranger behavior (see WeightedAvg_v1). The static measure I originally mentioned can be seen in WeightedAvg_v2.

weightedavg_graph.PNG

However if you click a certain month in the dimension, the text box measures calculate as expected (7.33 for July/2017), despite the strange chart behavior:


weightedavg_v2.PNG

sunny_talwar

Would you be able to share a sample?

william_fu
Creator II
Creator II
Author

Hi Sunny,

This simpler measure is working just fine; apparently there was no need for Aggr/Total

Sum({$<[LLR.PdCorrente]-={100}>} [LLR.PdCorrente] *  Saldo)

/

Sum({$<[LLR.PdCorrente]-={100}>} Saldo)

Thanks for your help