Forum Discussion

andra2's avatar
andra2
Helper I
4 years ago
Solved

Direct Query question - latest date

Hello,    I am using direct query for a table having let's say these values: Team  Strategy  Stock   Section   Created On X 1 C 1 1/27/2022 1:14 X 1 C 2 1/27/2022 1:15 X 1 C 3...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi andra2 ,

    I created a sample pbix file(see attachment) for you, please check whether that is what you want.

    1. Create a measure as below to judge if it is the latest created on date group by  team, strategy and stock

    Flag = 
    VAR _latestdate =
        CALCULATE (
            MAX ( 'Table'[Created On] ),
            ALLEXCEPT ( 'Table', 'Table'[Team], 'Table'[Strategy], 'Table'[Stock] )
        )
    RETURN
        IF ( SELECTEDVALUE ( 'Table'[Created On] ) = _latestdate, 1, 0 )

    2. Apply a visual-level filter with condition "Flag is 1" to the table/matrix visual

    Best Regards