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.
I am trying to compare YTD sales to Previous YTD sales.
YTD formula:
SalesYTD = CALCULATE ( [Incoming Total Sales], FILTER ( ALL ( 'Calendar - Transaction Date' ), 'Calendar - Transaction Date'[Transaction Date Year Number] = MAX ( 'Calendar - Transaction Date'[Transaction Date Year Number] ) && 'Calendar - Transaction Date'[Transaction Date] <= MAX ( 'Calendar - Transaction Date'[Transaction Date]) ) )
PYTD Sales = CALCULATE ( [Incoming Total Sales], FILTER ( ALL ( 'Calendar - Transaction Date' ), 'Calendar - Transaction Date'[Transaction Date Year Number] = (MAX ( 'Calendar - Transaction Date'[Transaction Date Year Number]) -1) && 'Calendar - Transaction Date'[Transaction Date] <= MAX ( 'Calendar - Transaction Date'[PY Date]) ) )
However - the PYTD measure (no matter what variation I do) is pulling the FULL year for last year
Even using SAMPLEPERIODLASTYEAR. I can NOT figure out why it's doing that rather than pulling JUST the data for YTD LAST year.
Previous Year Sales (Incoming) = CALCULATE([Incoming Total Sales], SAMEPERIODLASTYEAR('Calendar - Transaction Date'[Transaction Date]))
ANY ideas as to WHY it's behaving this way? It's the same on EVERY report I have.
Solved! Go to Solution.
https://community.powerbi.com/t5/Desktop/Prior-year-year-to-date-sales/m-p/173509#M75776
So the solution from this forum question did the trick perfectly... it doesn't quite answer why the other methods didn't work - but for now, it gives the data I need.
here's the formula modified; it's quite a bear of a formula: lol
PYTD Sales = CALCULATE( [Incoming Total Sales], SAMEPERIODLASTYEAR( DATESYTD('Calendar - Transaction Date'[Transaction Date]) ), FILTER( ALL('Calendar - Transaction Date'), 'Calendar - Transaction Date'[Transaction Date Month Number] <= (MONTH(NOW())-1) ) )+ CALCULATE( [Incoming Total Sales], SAMEPERIODLASTYEAR( DATESYTD('Calendar - Transaction Date'[Transaction Date]) ), FILTER( ALL('Calendar - Transaction Date'), 'Calendar - Transaction Date'[Transaction Date Month Number] = MONTH(NOW()) && 'Calendar - Transaction Date'[Transaction Date Day Number] <= DAY(NOW()) ) )
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 |
---|---|
114 | |
99 | |
82 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |