March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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 )
Solved! Go to Solution.
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.
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.
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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |