I have been stuggling all day to get a sales YTD & PY calcuation to work as expected. Currently I have the following DAX calcutions:
1. Total Sales YTD = VAR LastSalesDate = MAXX( ALL('Sales Transactions'[InvoiceDate]), 'Sales Transactions'[InvoiceDate]) VAR YTDSales = TOTALYTD([Total Sales], 'Date table'[Date]) RETURN IF( MIN( 'Date table'[Date] ) <= LastSalesDate, YTDSales, BLANK()) 2. Total Sales YTD PY = IF(LASTDATE('Date table'[Date]) <= TODAY(), CALCULATE([Total Sales YTD], SAMEPERIODLASTYEAR('Date table'[Date])),BLANK())
In the below image you will see that they are mostly working but the YTD PY is giving a blank in the totals. Where am I going wrong?