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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply

How to calculate previous year to date ends with previous year current month

Hi Guys,

I have measure that calculate total units, i want to calculate previous year to date ends with previous year current month.
Today date - 10/4/2024
Logic is
PYTD = Jan-2023 to Sep-2023 ( because completed month in current year )

1 ACCEPTED SOLUTION
Kedar_Pande
Super User
Super User

@newlearnpbi123 

DAX measure:

PYTD_TotalUnits = 
CALCULATE(
[Total Units], -- Your total units measure
DATESBETWEEN(
'Date'[Date],
DATE(YEAR(TODAY()) - 1, 1, 1), -- Start from January 1 of the previous year
EOMONTH(DATE(YEAR(TODAY()) - 1, MONTH(TODAY()) - 1, 1), 0) -- End at the last day of the previous year's current month
)
)


This will calculate the total units for Jan 2023 to Sep 2023 (PYTD).

 

If this helped, a Kudos 👍 or Solution mark would be great!
Cheers,
Kedar Pande
www.linkedin.com/in/kedar-pande

View solution in original post

4 REPLIES 4

thank you so much, it is working,
is there any way i could use a column where there is a month id like "M001","M002","M003"
i could use the month id column in the end of month like filter.

Kedar_Pande
Super User
Super User

@newlearnpbi123 

DAX measure:

PYTD_TotalUnits = 
CALCULATE(
[Total Units], -- Your total units measure
DATESBETWEEN(
'Date'[Date],
DATE(YEAR(TODAY()) - 1, 1, 1), -- Start from January 1 of the previous year
EOMONTH(DATE(YEAR(TODAY()) - 1, MONTH(TODAY()) - 1, 1), 0) -- End at the last day of the previous year's current month
)
)


This will calculate the total units for Jan 2023 to Sep 2023 (PYTD).

 

If this helped, a Kudos 👍 or Solution mark would be great!
Cheers,
Kedar Pande
www.linkedin.com/in/kedar-pande

thank you so much, it is working,
is there any way i could use a column where there is a month id like "M001","M002","M003"
i could use the month id column in the end of month like filter.

Anonymous
Not applicable

Hi @newlearnpbi123 

 

Could you please provide some sample data and the expected results based on the sample data so that we can better help you? How to provide sample data in the Power BI Forum - Microsoft Fabric Community Or show them as screenshots or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

 

Best Regards,
Yulia Xu

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors