Forum Discussion
Prior Year to Date Billable
I'm trying to calculate the Prior Year to date for comparision
To get the Current YTD
Anonymous
If you add a calendar table to your model you can us your existing meausre and the SAMEPERIODLASTYEAR like this.
PYTD Billable = CALCULATE ( [YTD Billable], SAMESPERIODLASTYEAR ( Dates[Date] ) )- Anonymous4 years ago
I'm not sure i put it in right I got the same numbers
20/21 YTD Billable Hours = CALCULATE([YTD Billable], SAMEPERIODLASTYEAR('Work Date'[Date]))
7 Replies
- jdbuchanan71
Super User
Anonymous
If you add a calendar table to your model you can us your existing meausre and the SAMEPERIODLASTYEAR like this.
PYTD Billable = CALCULATE ( [YTD Billable], SAMESPERIODLASTYEAR ( Dates[Date] ) )- AnonymousNot applicable
I'm not sure i put it in right I got the same numbers
20/21 YTD Billable Hours = CALCULATE([YTD Billable], SAMEPERIODLASTYEAR('Work Date'[Date]))
- jdbuchanan71
Super User
You will get a different behaviour if you don't have a calendar table in your model and mark it as the calendar table. Time intelligence functions won't work correctly if you don't have a dedicated calendar table. It must also cover complete year from 1/1 - 12/31 so no partial years in your date table.
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
- AnonymousNot applicable
Okay is there another way to calculate it. I'm at a law firm and the calendar year is Nov - Oct.
Thanks,
Karrie
- jdbuchanan71
Super User
You can use CALENDARAUTO(10) to generate a calendar table with a year end in October but you need a dedicated calendar table that is flagged for the time intelligence to work correctly.
- AnonymousNot applicable
Thank you,
But that won't work, I'm in a live data connection and am not able to create tables
- V-lianl-msft
Community Support
Hi Anonymous ,
The formula in the third reply should work normally. Is the date field in the visual from 'Work Date'? If not, try using the date field in the 'Work Date'
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.