Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

IF Statement help

Good afternoon, Can someone tell me why this is not working?   IF ( YEAR( 'Casino Project Feb 2020'[Date] ) = YEAR (LASTDATE('Casino Project Feb 2020'[Date])) && MONTH( 'Casino Project Feb 2020...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Anonymous 

     

    This is because lastdate returns the current row, you will need to add All(table) as the context:

     

    Column = 
    var Lastdate_= CALCULATE(LASTDATE('Casino Project Feb 2020'[Date]),ALL('Casino Project Feb 2020'))
    Return 
    IF(YEAR( 'Casino Project Feb 2020'[Date] ) = YEAR (Lastdate_)
    && MONTH( 'Casino Project Feb 2020'[Date]) = MONTH (Lastdate_),
    "Yes","No")

     

     

    Best regards 

    Paul Zheng