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.
need to calculate a measure that could show values year-wise, the current year till date (Jan 1 - Nov 6 '20) vs previous year same period (Jan 1 - Nov 6 '19); a single measure that can show value for both years or separate measurefor 2019 & 2020. Also a % variance vs previous year
tried to use many measures but couldn't get the desired result,
Solved! Go to Solution.
well, i think i have figured out a solution by using an offset function available on the calendar table, filtering it on the day level;
well, i think i have figured out a solution by using an offset function available on the calendar table, filtering it on the day level;
@tabkaz , Try measures like these examples with a date table
YTD QTY forced=
var _max = today()
return
if(max('Date'[Date])<=_max, calculate(Sum('order'[Qty]),DATESYTD('Date'[Date])), blank())
//or
//calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),filter('Date','Date'[Date]<=_max))
//calculate(TOTALYTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<=_max))
Last year
LYTD QTY forced=
var _max = date(year(today())-1,month(today()),day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
Thanks Amit, the measures u have posted in not giving the desired result; YTD LY is not showing any result.
Hi @tabkaz,
I'd like to suggest you use date function to manually define the filter range and calculate, please take a look to follow if it helps:
Time Intelligence "The Hard Way" (TITHW)
If the above also not work for your scenario, please share some dummy data with the raw table structure and expected results to help us clarify your structure and test to coding formula.
How to Get Your Question Answered Quickly
BTW, I can't access the share link you posted, can you please fix this?
Regards,
Xiaoxin Sheng
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 | |
98 | |
78 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |