Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Latest Record Based on Date Slicer

First time question poster here!   Excel and PowerBi files here: https://www.dropbox.com/sh/g3pfws2xzkmqgqy/AADUrdKWRzHDSCQ5qF8gVQxDa?dl=0  I have change log of many aspects for employees, and I...
  • v-juanli-msft's avatar
    v-juanli-msft
    6 years ago

    Hi Anonymous 

    Check if it is correct on your side.

    Create a new table

    attribute = VALUES('Log'[Attribute])

    Modify measure as below

    attribute selected =
    VAR maxdate =
        CALCULATE (
            MAX ( 'Log'[Record Date] ),
            FILTER (
                ALLSELECTED ( 'Log' ),
                'Log'[Employee ID]
                    = MAX ( 'Log'[Employee ID] )
                    && 'Log'[In View] = 1
            )
        )
    VAR attr =
        CALCULATE (
            MAX ( 'Log'[Attribute] ),
            FILTER (
                ALLSELECTED ( 'Log' ),
                'Log'[Employee ID]
                    = MAX ( 'Log'[Employee ID] )
                    && 'Log'[Record Date] = maxdate
            )
        )
    RETURN
        IF (
            HASONEFILTER ( attribute[Attribute] ),
            IF (
                SELECTEDVALUE ( attribute[Attribute] ) = attr,
                attr
            ),
            attr
        )
    

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.