Forum Discussion

ronaldbalza2023's avatar
ronaldbalza2023
Continued Contributor
3 years ago

Current Year - Custom filter

Hi everyone, I have a custom filter that uses time intelligence function. How can I modify this measure in order to reflect the current year on variables _mtd, _qtd, and _ytd? 

Period Filter = 
VAR _selectedperiod =
    SELECTEDVALUE ( 'Date Period Slicer'[Order By] )
VAR _mtd =
    MAX ( 'Date'[Date] ) IN DATESMTD ( 'Date Periods'[Date] )
VAR _qtd =
    MAX ( 'Date'[Date] ) IN DATESQTD ( 'Date Periods'[Date] )
VAR _ytd =
    MAX ( 'Date'[Date] ) IN DATESYTD ( 'Date Periods'[Date] )
VAR _6months =
    MAX ( 'Date'[Date] )
        IN FILTER (
            'Date Periods',
            'Date Periods'[Date] <= TODAY ()
                && 'Date Periods'[Date]
                    >= TODAY () -180
        )
VAR _all =
    MAX ( 'Date'[Date] ) IN ALL ( 'Date Periods'[Date] )
RETURN
    INT (
        SWITCH ( _selectedperiod,
         1, _mtd,
         2, _qtd,
         3, _ytd,
         4, _6months,
         5, _all
         )
    )

 

1 Reply

  • Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?