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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
sheebharani
Regular Visitor

Average of 12 months, average of prior 12 months and sum at the bottom in matrix

Hi All,

 

I am trying to get average of 12 months (excluding the current month),  average of prior 12 months and sum at the bottom. Also the cell vales have to be sum and not average.

I have current month and -13 months as column with customer name on rows in the display and not prior 12 months(i.e not complete 25 months - current month -12 -12).

If i add average measure it will repeat for every month.

I do not want that, i wnat to just show averages at the end and sum at the bottom.

 

 

Customer Name2024-042024-032024-022024-012023-122023-112023-102023-092023-082023-072023-062023-052023-04Average of 12 momthsAverage of prior 12 months
ABC  10         152.083
XYZ-30102030354045505560708090

48.75

50
Total-30103030354045505560708010550.8353

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks @Greg_Deckler 

Hi, @sheebharani 

Based on your description, a similar matrix visual was created using the following sample data:

vjianpengmsft_0-1712820149305.png

vjianpengmsft_1-1712820199690.png

I use the following DAX expression in the matrix:

EachMonth = SUM('Table'[value])
Totals =
IF (
    ISINSCOPE ( 'Table'[Date] ),
    SUM ( 'Table'[value] ),
    DIVIDE ( SUM ( 'Table'[value] ), 12 )
)

vjianpengmsft_2-1712820390475.png

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

2 REPLIES 2
Anonymous
Not applicable

Thanks @Greg_Deckler 

Hi, @sheebharani 

Based on your description, a similar matrix visual was created using the following sample data:

vjianpengmsft_0-1712820149305.png

vjianpengmsft_1-1712820199690.png

I use the following DAX expression in the matrix:

EachMonth = SUM('Table'[value])
Totals =
IF (
    ISINSCOPE ( 'Table'[Date] ),
    SUM ( 'Table'[value] ),
    DIVIDE ( SUM ( 'Table'[value] ), 12 )
)

vjianpengmsft_2-1712820390475.png

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

Greg_Deckler
Community Champion
Community Champion

@sheebharani Hard to know for sure, but seems like you need a variety of things here. 

 

First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8

 

Also, you will need Custom Matrix Hierarchy: The New Hotness (Custom Matrix Hierarchy) - Microsoft Fabric Community

 

And probably Better Rolling Average: Better Rolling Average - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.