Forum Discussion
Help with Average per team distribution
- 5 years ago
You can aggregate subtotal averages rather than a standard average like this:
AVERAGEX ( VALUES ( Sales[Team] ), [ProductAvg] )where [ProductAvg] is whatever measure you already have defined, presumably something like
DIVIDE ( SUM ( Sales[Amount] ), CALCULATE ( SUM ( Sales[Amount] ), ALLSELECTED ( Sales[Product] ) ) )
I know it is slightly weird, but yes, that is how I need it.
You can aggregate subtotal averages rather than a standard average like this:
AVERAGEX ( VALUES ( Sales[Team] ), [ProductAvg] )where [ProductAvg] is whatever measure you already have defined, presumably something like
DIVIDE (
SUM ( Sales[Amount] ),
CALCULATE ( SUM ( Sales[Amount] ), ALLSELECTED ( Sales[Product] ) )
)- Yes1235 years agoFrequent Visitor
Awesome! Looks so simple, once you know. Thank you!
- Yes1235 years agoFrequent Visitor
One question though and I'm sure this a stupid one... It works fine, but why can't I have the [ProductAvg] as a VAR? Doing it that way it is slightly of
Measure = VAR Per_Team = DIVIDE ( SUM ( Sales[Amount] ), CALCULATE ( SUM ( Sales[Amount] ), ALLSELECTED ( Sales[Product] ) ) ) Return AVERAGEX(VALUES(Sales[Team]),Per_Team)- AlexisOlson5 years agoSuper User
When you declare a variable, it is computed once and reused as a constant through the rest of the measure, so you'd be averaging the same value ignoring the Team.