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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
madisonkelly
Regular Visitor

Monthly Comparison with yearly average

I need to create a table or matrix that breaks the data into 4 columns: this month, last month, average of last 6 months, and avg of last 12 months.

madisonkelly_0-1654195812055.png

 

What is the best way to go about this? I tried grouping the data, but the groups can't overlap (ie 4/20/22 would need to be included in last month, last 6 months, and last 12 months. I also tried this formula 

Last month = CALCULATE('Charge Data'[Total Charges],dateadd('Charge Data'[Date Satisfied],-1,MONTH))
But adding that measure to the matrix values just includes it as a new row... If that makes any sense?
 
Any and all help is appreciated! 
1 ACCEPTED SOLUTION
Whitewater100
Solution Sage
Solution Sage

Hi:

If you are asking how to display matrix on rows you can do hat in formatting, I'll post image here.

Whitewater100_0-1654196921073.png

If you are asking about measures,it's best to get a Date Table in your model, with relationship with Fact Table. I'll paste date table code below. MODELING>NEW TABLE ..see last part of this message. You will have a new field in the dates table Dates[Date] that should be used in visuals and also your measures.

Let]s say you have a measure for Total Charges:

Total Charges = SUM('Charge Data'[Total Charges])

Then you use this pattern with DATEADD function

Last Month Charges = CALCULATE([Total Charges], DATEADD(Dates[Date], -1, MONTH))

Charges last 6 months = CALCULATE([Total Charges], DATEADD(Dates[Date], -12, MONTH))
Last 12 Month Charges = CALCULATE([Total Charges], DATEADD(Dates[Date], -1, YEAR))

 

I hope this helps:

Date Table cose next:

Dates = ADDCOLUMNS ( CALENDAR (FIRSTDATE(Sheet1[ Date]), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )

View solution in original post

1 REPLY 1
Whitewater100
Solution Sage
Solution Sage

Hi:

If you are asking how to display matrix on rows you can do hat in formatting, I'll post image here.

Whitewater100_0-1654196921073.png

If you are asking about measures,it's best to get a Date Table in your model, with relationship with Fact Table. I'll paste date table code below. MODELING>NEW TABLE ..see last part of this message. You will have a new field in the dates table Dates[Date] that should be used in visuals and also your measures.

Let]s say you have a measure for Total Charges:

Total Charges = SUM('Charge Data'[Total Charges])

Then you use this pattern with DATEADD function

Last Month Charges = CALCULATE([Total Charges], DATEADD(Dates[Date], -1, MONTH))

Charges last 6 months = CALCULATE([Total Charges], DATEADD(Dates[Date], -12, MONTH))
Last 12 Month Charges = CALCULATE([Total Charges], DATEADD(Dates[Date], -1, YEAR))

 

I hope this helps:

Date Table cose next:

Dates = ADDCOLUMNS ( CALENDAR (FIRSTDATE(Sheet1[ Date]), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.