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
Anonymous
Not applicable

Prior Month YTD Issue

I am trying to work with 2 measures: 

Current Month YTD and Prior Month YTD
to have a final result with: 
Current Month = [Current Month YTD]-[Prior Month YTD]
 
I am using the following dax code which works perfect until year 2019:
Current Month YTD = CALCULATE([Total Group Currency], DATEADD(Dates[Date].[Date], 0, MONTH ) )
Prior Month YTD = CALCULATE([Total Group Currency], DATEADD(Dates[Date], -1, MONTH), MONTH(Dates[Date])<>12)
 
But, for some reason my Prior Month YTD calculates one additional month (with no data in current month YTD) and this makes my final result 0:
2019-04-11_10-07-59.jpg
 
 
 
 
Prior Month YTD should be 19.626.002,68. 
Should anyone has any advice, that really will help me.
 
Thanks
1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You can change measure Prior Month YTD using DAX below.

 

Prior Month YTD = IF([Current Month YTD]=BLANK(),BLANK(),CALCULATE([Total Group Currency], DATEADD(Dates[Date], -1, MONTH), MONTH(Dates[Date])<>12))

 

Best Regards,

Amy

 

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

5 REPLIES 5
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You can change measure Prior Month YTD using DAX below.

 

Prior Month YTD = IF([Current Month YTD]=BLANK(),BLANK(),CALCULATE([Total Group Currency], DATEADD(Dates[Date], -1, MONTH), MONTH(Dates[Date])<>12))

 

Best Regards,

Amy

 

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

Anonymous
Not applicable

It works for me .Thanks.KG
Anonymous
Not applicable

Hi, @v-xicai 

 

Thanks for your answer, I'm afraid that my total is still working wrong =(, now I do not see April any more but I'm not sure why the Total sum is still the same as before:

 

2019-04-12_11-13-00.jpg

 

Yessi

Hi @Anonymous ,

 

Try to refresh , or you can try it again after updating to the latest version of Power BI Desktop 2.68.5432.841.

 

Best Regards,

Amy

 

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

Anonymous
Not applicable

Hi @v-xicai ,

 

Currently in the company we have a previous version of PBI Desktop, I hope we have available the last one soon, then, I can check if that solves the problem.

 

Thank you.

Regards.

Yessi 

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.