Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Dear all,
I´m trying a "simple" measure to calculate the cumulative values from the beginning of the year until "today".
The formula below works, but notice I´m fixing the "year_end_date"
YTD Values =
TOTALYTD([Total Values];Dates[Dates];ALL(Dates[Dates]);"9/5")
However, if I try to set up "9/5" as a formula, like "TODAY()", or other vars, it gives me an error.
YTD Values =
var Today = MONTH(TODAY()) & "/" & DAY(TODAY())
return
TOTALYTD([Total Values];Dates[Dates];ALL(Dates[Dates]);Today)
Help?
Solved! Go to Solution.
@Anonymous
Just clarifying your requirements...
If today is 5-Sep-2017, then what date range do you expect the formula to calculate over?
As a side note, in the TOTALYTD or DATESYTD functions, year_end_date can never be any expression apart from a string literal. If you want a flexible year_end_date, you have to write the time intelligence logic from scratch without using the built-in time intelligence functions.
Owen 🙂
From your insight, I came to this scratch formula that seems to work for me.
Thank you!
YTD Values = var ActualMonthBeginning = DATE(YEAR(TODAY());MONTH(TODAY());01) var YearBeginning = DATE(YEAR(MIN(Dates[dates]));01;01) return CALCULATE([Total Values] ;FILTER(Values ;Values[Dates] < ActualMonthBeginning && Values[Dates] >= YearBeginning ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
100 | |
80 | |
63 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |