March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |