Forum Discussion

setis's avatar
setis
Post Partisan
5 years ago
Solved

Last selected year

Hi!

 

I have a year slicer from the column Year in my Date table, in which I select 2018, 2019 and 2020. 

 

I am trying to capture in a variable the last year (2020). 

 

I was trying this, but is wrong. 

 

 

VAR DataMaxYear = MAX ( YEAR(SELECTEDVALUE('Date'[Date]) ))

 

 

Thank you in advance!

  • Hi setis ,

     

    Try this:

    max year =
    VAR y = YEAR ( MAX ( DateTable[Date] ) ) RETURN y

     

    This should work

1 Reply

  • PC2790's avatar
    PC2790
    Community Champion

    Hi setis ,

     

    Try this:

    max year =
    VAR y = YEAR ( MAX ( DateTable[Date] ) ) RETURN y

     

    This should work