Forum Discussion

asebes's avatar
asebes
Frequent Visitor
5 years ago
Solved

YTD Context in Matrix

Seems like this should be easy but can't quite get my DAX Measure to work.  All I need is a YTD row in my matrix based on the applicable month.   So my matrix shows the previous 6 months and need a...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi asebes ,

    You can create a measure as below and apply a relative date slicer, please find the details in the attachment.

    Measure = 
    VAR _curdate =
        SELECTEDVALUE ( 'Table'[date] )
    RETURN
        CALCULATE (
            SUM ( 'Table'[data] ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[date] >= DATE ( YEAR ( _curdate ), 1, 1 )
                    && 'Table'[date] <= EOMONTH ( _curdate, 0 )
            )
        )

    Best Regards