Forum Discussion
MTD and YTD table
- 4 years ago
Hi SarahESkells ,
According to your description, if you use the DATESMTD, DATESQTD, DATESYTD functions in the MTD, QTD, YTD measures, it can't return correct result because these functions refer to a date column which doesn't exsit in your visual. Here's my solution, create three measures.
MTD = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', EOMONTH ( 'Table'[Date], 0 ) = EOMONTH ( TODAY (), 0 ) ) )QTD = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', YEAR ( 'Table'[Date] ) = YEAR ( TODAY () ) && QUARTER ( 'Table'[Date] ) = QUARTER ( TODAY () ) ) )YTD = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', YEAR ( 'Table'[Date] ) = YEAR ( TODAY () ) ) )Get the correct result.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi SarahESkells ,
According to your description, if you use the DATESMTD, DATESQTD, DATESYTD functions in the MTD, QTD, YTD measures, it can't return correct result because these functions refer to a date column which doesn't exsit in your visual. Here's my solution, create three measures.
MTD =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', EOMONTH ( 'Table'[Date], 0 ) = EOMONTH ( TODAY (), 0 ) )
)
QTD =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
'Table',
YEAR ( 'Table'[Date] ) = YEAR ( TODAY () )
&& QUARTER ( 'Table'[Date] ) = QUARTER ( TODAY () )
)
)
YTD =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', YEAR ( 'Table'[Date] ) = YEAR ( TODAY () ) )
)
Get the correct result.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.