Forum Discussion
Calculate the average
- 4 years ago
Try something like:
AVERAGEX ( VALUES ( SALES[Category] ), CALCULATE ( SUM ( SALES[Price] ) ) )
VALUES gives a distinct list of categories.AVERAGEX then iterates over this list of categories and calculates the sum of prices for each.
You need the CALCULATE statement there to turn the row context that you're on into a filter context on the table. If you leave it out it will just return the total price for the whole table.
Once it has a sum for each category averagex divides by the number of categories.
- Anonymous4 years ago
Hi,
Please follow below steps
1. Create a measure with below Dax
Distinct Category = DISTINCTCOUNT('Table'[Category])2. Create one more measure for calculating AverageAverage Price by category = sum('Table'[Price])/[Distinct Category]I have attached solution in sample file and uploaded on Sharepoint
https://onedrive.live.com/?cid=9429FE789841BAAD&id=9429FE789841BAAD%21106&parId=root&o=OneUp
Please confirm if the solution works..!!
Hi,
Please follow below steps
1. Create a measure with below Dax
I have attached solution in sample file and uploaded on Sharepoint
https://onedrive.live.com/?cid=9429FE789841BAAD&id=9429FE789841BAAD%21106&parId=root&o=OneUp
Please confirm if the solution works..!!