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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
kk_shp_user
Helper I
Helper I

How to get average of monthly values for per year per category

My dataset looks like the below,

 

kk_shp_user_0-1688751645395.png

 

I have created a matrix visual as below,

 

kk_shp_user_1-1688751672055.png

The values in the matrix visuals are distinctcount of the ids.

 

Now, I want to calculate the average value of the red boxes (i.e.) the average of monthly values for each year for each category. How can I get this in DAX?

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_0-1688803098257.png

 

Jihwan_Kim_1-1688803782188.png

 

Expected outcome measure: = 
AVERAGEX (
    WINDOW (
        1,
        ABS,
        12,
        ABS,
        SUMMARIZE (
            ALL ( 'Calendar' ),
            'Calendar'[Year],
            'Calendar'[Year-Month],
            'Calendar'[Year-Month sort]
        ),
        ORDERBY ( 'Calendar'[Year-Month sort], ASC ),
        ,
        PARTITIONBY ( 'Calendar'[Year] )
    ),
    CALCULATE ( COUNTROWS ( Data ) )
)

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_0-1688803098257.png

 

Jihwan_Kim_1-1688803782188.png

 

Expected outcome measure: = 
AVERAGEX (
    WINDOW (
        1,
        ABS,
        12,
        ABS,
        SUMMARIZE (
            ALL ( 'Calendar' ),
            'Calendar'[Year],
            'Calendar'[Year-Month],
            'Calendar'[Year-Month sort]
        ),
        ORDERBY ( 'Calendar'[Year-Month sort], ASC ),
        ,
        PARTITIONBY ( 'Calendar'[Year] )
    ),
    CALCULATE ( COUNTROWS ( Data ) )
)

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thanks! This worked 🙂

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.