Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi everyone. I'm trying to calculate the average from differents company's areas by month from the following dataset structure:
So basically, I want to sum all the values of an area on each month and divide by the number of month. How can i do it in a single measure on dax?
You can check the data here: https://docs.google.com/spreadsheets/d/1yIAAD2Sh8fKpDMNip1MHhHPQGBlU7XgL_6QpV1Fb7gs/edit?usp=sharing
It has two workbooks, one with the data (Data) and another with the Average that I want.
Solved! Go to Solution.
Hi @Anonymous ,
I created a sample pbix file(see the attachment), please check if it is what you want.
Measure =
VAR _count =
CALCULATE ( DISTINCTCOUNT ( 'Data'[Month-year] ), ALLSELECTED ( 'Data' ) )
VAR _sumvalue =
CALCULATE (
SUM ( 'Data'[Value] ),
FILTER ( ALLSELECTED ( 'Data' ), 'Data'[Area] = SELECTEDVALUE ( 'Data'[Area] ) )
)
RETURN
IF (
ISINSCOPE ( 'Data'[Month-year] ),
SUM ( 'Data'[Value] ),
DIVIDE ( _sumvalue, _count )
)
Best Regards
Hi @Anonymous ,
You can write a below measure and put it inside value of matrix.
Regards
DarkInvader_
Hey, @darkinvader_ , thank you so much for ansewering so fast!
Your solution works like a charm for each month. But when i check the total row, it comes with the sum of the months average. I believe there's a way to make this measure with averageX. But I'm failing to do it.
Hi @Anonymous ,
I created a sample pbix file(see the attachment), please check if it is what you want.
Measure =
VAR _count =
CALCULATE ( DISTINCTCOUNT ( 'Data'[Month-year] ), ALLSELECTED ( 'Data' ) )
VAR _sumvalue =
CALCULATE (
SUM ( 'Data'[Value] ),
FILTER ( ALLSELECTED ( 'Data' ), 'Data'[Area] = SELECTEDVALUE ( 'Data'[Area] ) )
)
RETURN
IF (
ISINSCOPE ( 'Data'[Month-year] ),
SUM ( 'Data'[Value] ),
DIVIDE ( _sumvalue, _count )
)
Best Regards
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
104 | |
69 | |
49 | |
41 | |
34 |
User | Count |
---|---|
164 | |
111 | |
62 | |
53 | |
38 |