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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Ria
Frequent Visitor

3 Month YoY comparison

My goal is to create a table similar to the visualization matrix below.  This works great except when the 3 month period straddles 2 differenct years.  (December, January, February).   I've tried to recreate this with the PreviousMonths function, but still have the same issue and have the additional problem of having the previous month next to the current month and not separated as below.  Do I need to create separate measures for each of current month, current month minus 1 month, minus 2 months etc.? and how? I'm new to DAX Time Intelligence functions and with a lot of help from past postings have created a Dates table and the Prior Month Sales, but now am stuck.

 2015  2015 Total2016  2016 TotalGrand Total
 FebruaryMarchApril FebruaryMarchApril  
Customer A93134139366887882248614
Customer B525594202655393211413
Customer C13811314265    265
TOTAL2833022478321531311754591,291
6 REPLIES 6
v-sihou-msft
Microsoft Employee
Microsoft Employee

@Ria

 

I assume you have fact data per Customer per Month in the fact table. If you just want to display a matrix, you just need to have month group on Year in Column Group of the matrix, then use a slicer to filter expected 3 months.

 

If you want to calculate the PreviousMonth, Current Month - 2 month Total. You can just use PARALLELPERIOD() in your calculation. 

 

Measure = CALCULATE(SUM('Table'[Amount]),PARALLELPERIOD('Table'[Date],-1,MONTH))

Regards,

 

GilbertQ
Super User
Super User

Hi @Ria

 

What about creating a calculated measure with the following below:

 

YOY = CALCULATE([Measure],SAMEPERIODLASTYEAR('Date'[Calendar Date']))

What this will do, is based on which ever date period you put into your table, it will go to the same period of the previous years and subsequent years.

 

One thing to note is that you MUST put in the Date columns from your Date table for this to work as expected.

 

And then put in this measure above into your data as shown below?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Ria
Frequent Visitor

This gives me the information I am looking for but is it possible to change the presentation?

 

Currently:

 

MonthInCalendar                                                 Dec 16                                   Jan 17                          Feb 17                Total

Customer                                                     PR YR       SALES                     PR YR      SALES                PR YR    SALES      PR YR   SALES

A                                                                   82               96                         85              133                  87          113         254      342     

(Rows:   Customer.   Columns:  MonthInCalendar.  Values:  PR YR, Sales.)

___________________________________________________________________________________________________________________________________________

Requested Presentation:                  Dec 15           Jan 16       Feb 16  Total     Dec 16     Jan 17     Feb 17    Total

Customer A                                        82                    85            87        254        96            133          113        342

 

v-sihou-msft
Microsoft Employee
Microsoft Employee

@Ria

 

No, it's not possible have lengend group on measures, you can only have measures group on legend.

 

Regards,

 

Ria
Frequent Visitor

This gives me the information I am looking for, but if possible is there a way to change the presentation.

Currently:

 

MonthInCalendar

 

Phil_Seamark
Microsoft Employee
Microsoft Employee

Can you please post a sample of your data so we can help creating the measures.

 

It looks doable. 🙂


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors