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.
Hi All
I am trying to use TOTALYTD to calculate the YTD sales, with my fiscal year ending at 30/06. Using the above formula should cover the period from 1/7/2019 onwards.
I am looking to calculate the previous year (which should cover 1/6/2018 to 30/06/2019) using the formula:
However, it doesn't seem to calculate as I expected, would someone please advise?
File can be downloaded from: https://www.dropbox.com/s/qjkkp78vp4ttmoc/TOTALYTD.pbix?dl=0
Thanks!
Solved! Go to Solution.
Hi @swwong1
Uploaded edited pbix here.
DateTable = VAR YearEndMonth = 6 VAR MonthShift = 12 - YearEndMonth VAR MinDatePlus6Months = EDATE ( MIN ( DATA[Date] ), MonthShift ) VAR MaxDatePlus6Months = EDATE ( MAX ( DATA[Date] ), MonthShift ) VAR CalendarStart = EDATE ( DATE ( YEAR ( MinDatePlus6Months ), 1, 1 ), - MonthShift ) VAR CalendarEnd = EDATE ( DATE ( YEAR ( MaxDatePlus6Months ), 12, 31 ), - MonthShift ) RETURN CALENDAR ( CalendarStart, CalendarEnd )Or check out https://www.sqlbi.com/tools/dax-date-template/
Total Sales Fiscal Year = TOTALYTD([Total Sales],DateTable[Date],"30/06")
Hopefully that fixes the issues. Please post back if needed 🙂
Regards,
Owen
Hi @swwong1
Uploaded edited pbix here.
DateTable = VAR YearEndMonth = 6 VAR MonthShift = 12 - YearEndMonth VAR MinDatePlus6Months = EDATE ( MIN ( DATA[Date] ), MonthShift ) VAR MaxDatePlus6Months = EDATE ( MAX ( DATA[Date] ), MonthShift ) VAR CalendarStart = EDATE ( DATE ( YEAR ( MinDatePlus6Months ), 1, 1 ), - MonthShift ) VAR CalendarEnd = EDATE ( DATE ( YEAR ( MaxDatePlus6Months ), 12, 31 ), - MonthShift ) RETURN CALENDAR ( CalendarStart, CalendarEnd )Or check out https://www.sqlbi.com/tools/dax-date-template/
Total Sales Fiscal Year = TOTALYTD([Total Sales],DateTable[Date],"30/06")
Hopefully that fixes the issues. Please post back if needed 🙂
Regards,
Owen
Thanks @OwenAuger
I will read up on point 1 as I usually just use the Minimum and Maximum year, taking months from Jan and Dec
Since my example was fiscal year, I had to take maximum year + 1 to have complete fiscal years
Hi @swwong1 ,
I 'm a little confused about your requirement.
What is the start date for a year based on your scenario? "1/1" or "6/1"?
Best Regards,
Cherry
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 |
---|---|
112 | |
99 | |
73 | |
72 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |