Forum Discussion
Average calculation
- 4 years ago
That's really odd.
can you create a new test measure same as above but without the difference.
Test Measure VAR AverageAllClasses = CALCULATE ( [Average by Class], REMOVEFILTERS() ) RETURN AverageAllClassesDrop that into matrix as well and send results.
I think you just need a measure like this:
Average by Class =
AVERAGEX (
VALUES ( Result[Class] ),
CALCULATE ( AVERAGE ( Result[Score] ) )
)
VALUES ( Result[Class] ) creates a list of classes.
AVERAGEX then iterates over this list and calculates an AVERAGE for each.
The CALCULATE is needed as it forces a context transition so you only get an average for the current class.
You can then use the measure in a matrix visual which you can see in this demo.
bcdobbs Thanks sir. The card is showing
Actually I am trying to add a column which will provide me the difference between average score by class & average of that class. I need a measure for the same.
Can you pls help me with the same which will provide me difference bewteen Average score of specific Class & verage score by Class
- bcdobbs4 years ago
Community Champion
Avg Difference = VAR AverageAllClasses = CALCULATE ( [Average by Class], REMOVEFILTERS() ) RETURN [Average by Class] - AverageAllClasses
Try this.
Add a matrix visual with classes on the rows and drop this into the values.- harshadrokade4 years ago
Post Partisan
THanks bcdobbs Sir.
I tried this but it is giving me wrong values as below-
The correct difference values after I manually deduct the average of class from average by class is as below.
- bcdobbs4 years ago
Community Champion
Can you drop average by class into the visual and also into a card and send screen shot?
(Or better send your pbix file)