Forum Discussion
WishAskedSooner
1 year agoContinued Contributor
YTD Chart Not Working Properly
I am playing around in the Adventure Works PBIX. One scenario I am testing is when the dates don't align exactly in the fact table. For example, I edited the fact table and deleted all the rows for B...
- 1 year ago
WishAskedSooner try something like this, replace table and column names as per your model
YTD Last Transaction Date = VAR __LastTransactionDate = CALCULATE ( MAX ( Sales[OrderDate] ), ALL () ) RETURN CALCULATE ( [Sales], DATESYTD ( CALCULATETABLE ( VALUES ( 'Calendar'[Date] ), KEEPFILTERS ( 'Calendar'[Date] <= __LastTransactionDate ) ) ) )
parry2k
1 year agoSuper User
WishAskedSooner try something like this, replace table and column names as per your model
YTD Last Transaction Date =
VAR __LastTransactionDate = CALCULATE ( MAX ( Sales[OrderDate] ), ALL () )
RETURN
CALCULATE (
[Sales],
DATESYTD (
CALCULATETABLE (
VALUES ( 'Calendar'[Date] ),
KEEPFILTERS (
'Calendar'[Date] <= __LastTransactionDate
)
)
)
)