Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
77 | |
63 | |
51 | |
47 |
User | Count |
---|---|
212 | |
82 | |
61 | |
60 | |
57 |