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 there,
I am facing an issue with my YTD calculation in Power BI Desktop. I have YTD measures for calculating sales for every year, 2022, 2023, 2024 and the current year. Currently, all previous year measures are carrying the data of the whole year when I apply them.
I have tried to apply filters for the given year inside my calculation, and outside, but it did not help. If you faced a similar issue, would love to learn how you solved it.
Thank you
Hi @el_sa
Can you share your measure and a sample with expected results?
Hello
Here is my current DAX Measure, DateDimension table is a date dimension. Expected output is the number of YTD users in a given year.
Hi @el_sa
are you attempting to do a rolling total for the year 2024?
That's right
Hi @el_sa
In that case, this should work for you:
RollingTotal_2024 =
VAR _CurrDate = MAX(DateDimension[Date])
VAR _Year = 2024
RETURN
/*
Find current date and use less than or equal to to get rolling total.
Then using DatesYTD to only keep evaluation for dates within the same year
Finally, return only year in context
*/
CALCULATE( SUM(Sales[TypeA]), DateDimension[Date] <= _CurrDate, DATESYTD(DateDimension[Date]), DateDimension[Year] = _Year )
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
97 | |
65 | |
45 | |
39 | |
31 |
User | Count |
---|---|
164 | |
111 | |
61 | |
53 | |
38 |