Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I'm trying to create a measure to get Previous year YTD Sales but having trouble converting SamePeriodLastYear in form of Calculate (i.e. Third Method in my code).
I'm using ContosoDw for reference and below is code of two measure.
PY YTD Sales = /* // Method One CALCULATE ( [SalesAmount], SAMEPERIODLASTYEAR ( DATESYTD ( 'Date'[Date] ) ) )*/ // Second Method CALCULATE ( [SalesAmount], DATESYTD ( SAMEPERIODLASTYEAR ( 'Date'[Date] ) ) ) /* // Third Method CALCULATE ( [SalesAmount], FILTER ( ALL ( 'Date' ), AND ( 'Date'[Date] >= DATE(YEAR(DATEADD('Date'[Date] ,-1,YEAR)),1,1), // 'Date'[Date] <= DATE (YEAR(DATEADD('Date'[Date] ,-1,YEAR)), MONTH('Date'[Date]), DAY('Date'[Date]) ) 'Date'[Date] <= DATE (YEAR(DATEADD('Date'[Date] ,-1,YEAR)),3,31) ) ) )*/
Below SS while using Third Method
See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
User | Count |
---|---|
15 | |
9 | |
8 | |
6 | |
5 |
User | Count |
---|---|
31 | |
18 | |
13 | |
7 | |
5 |