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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
doubi1899
Regular Visitor

YOY calculation

For first column I use following code to calculate the total revenue of crruent month. It did work.

"Current = TOTALMTD([total revenue],'IOSalesRecordbyCustomer'[Date])"

 

And second column I want to calculate the total revenue of same month of last year.  By the way , I already create a datesheet by using "Dates = CALENDAR("2022/01/01""2024/06/01")"

Following is the code of the YOY

 

"YOY = CALCULATE(sum(IOSalesRecordbyCustomer[Total Revenue]),PARALLELPERIOD('Dates'[Date],-1,MONTH))"

 

It failed and not sure why shows the same number ( the exact number - the total revenue of current month)

https://drive.google.com/file/d/10wx09SN3fd5oceYe4PvKxadHZCsITUw4/view?usp=drive_link  

1 (1).jpg

 
 
1 ACCEPTED SOLUTION

@doubi1899 I think I've identified the problem.
1. Relate the Dates table to the Fact table via a many-to-one relationship, like this:

BeaBF_0-1720446927578.png

 

2. Then Use Date field of Dates Table in the matrix, not the field of the fact table.

 

Your measure will work.

 

BeaBF_1-1720446993168.png

 

 

BBF

View solution in original post

4 REPLIES 4
BeaBF
Super User
Super User

@doubi1899 Hi! I'va sent you the request to access the file. 

Meanwhile, try with these formulas:

Current = TOTALMTD([Total Revenue], 'Dates'[Date])

YoY = CALCULATE(
SUM(IOSalesRecordbyCustomer[Total Revenue]),
SAMEPERIODLASTYEAR('Dates'[Date])
)

YoYComparison = [CurrentMonthRevenue] - [YoY]

 

BBF

approved the request.

@doubi1899 I think I've identified the problem.
1. Relate the Dates table to the Fact table via a many-to-one relationship, like this:

BeaBF_0-1720446927578.png

 

2. Then Use Date field of Dates Table in the matrix, not the field of the fact table.

 

Your measure will work.

 

BeaBF_1-1720446993168.png

 

 

BBF

thank you so much. I realized where the mistake is.

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.