Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don'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.

Reply
Anonymous
Not applicable

Average of area by month

Hi everyone. I'm trying to calculate the average from differents company's areas by month from the following dataset structure:

 

FelipeJaworoski_0-1680699229722.png

 

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.

1 ACCEPTED 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 )
    )

vyiruanmsft_0-1681971794304.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
darkinvader_
Resolver I
Resolver I

Hi @Anonymous ,
You can write a below measure and put it inside value of matrix.

M_Average Value = CALCULATE(SUMX(Table1,DIVIDE(SUM(Table1[Value]),COUNT(Table1[Month-year]))))
In Matrix Put Area in Column and Month-year in Row.
Table1 is your table name

If you find it helpfull please gives a thumbs up.
happy to help you 🙂



Regards
DarkInvader_

Anonymous
Not applicable

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 )
    )

vyiruanmsft_0-1681971794304.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you so much, @v-yiruan-msft!!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.