Forum Discussion

poojag820's avatar
poojag820
Helper I
1 year ago
Solved

Max Date Check

I need to calcuate max date flag against my data to show data in table only for latest month.  Now the catch is that in my data future months are also available but data is only available till june ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi poojag820 ,

    Thanks for bhanu_gautam's reply!

    And poojag820 , please try this way:
    Not sure if your data looks like this, this is my test data:

    Use this DAX to create a measure:

    Flag = 
    VAR _Date = 
    CALCULATE(
        MAX('Table'[Date]),
        ALL('Table'),
        'Table'[Value] <> BLANK()
    )
    RETURN
    IF(
        MONTH(MAX('Table'[Date])) = MONTH(_Date) && YEAR(MAX('Table'[Date])) = YEAR(_Date),
        1,
        0
    )

    Then all rows corresponding to the largest month in the table where Value exists will be marked as 1, and the others as 0.

    You can then filter to show only data with measure=1.

    Best Regards,
    Dino Tao
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.