The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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...