Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi
I've asked the question before and it got solved. I'm not replicating the solutions and I can't get it to work.
I have a sales table with sales recorded from 01/01/2022 to 01/04/2023. I've created a data table with the same range and created a relation between the 2.
I can pull off current year sales not a problem. When I try to create previous year sales it's totalling the full month of april last year as well when it should be 01/01/2022..01/04/2022
It should be 84k but it's returning 120k.
I've tried the following
Sales PY (£) =
CALCULATE(SUM(SalesDashboard[SalesAmountActual]),SAMEPERIODLASTYEAR('Date'[Date]))
YTD LY (limited by last date in Data table) =
VAR DataMaxDate =
CALCULATE ( MAX ( 'Date'[Date] ), ALL ( SalesDashboard ) )
RETURN
CALCULATE (
[YTD],
SAMEPERIODLASTYEAR (
INTERSECT (
VALUES ( 'Date'[Date] ),
DATESBETWEEN ( 'Date'[Date], BLANK (), DataMaxDate )
)
)
)
Any suggestions?
@Lewis_S_William Try Better Year to Date: Better Year to Date Total - Microsoft Fabric Community
Please try this modified version :
YTD LY (limited by last date in Data table) =
VAR DataMaxDate =
CALCULATE ( MAX ( 'Date'[Date] ), ALL ( SalesDashboard ) )
RETURN
CALCULATE (
[YTD],
SAMEPERIODLASTYEAR (datesytd('Date'[Date])), all(dimdate[Date])
)
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅!
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠