Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Tracking User Changes Over Time

Suppose I have a list of users like so: Usernames Date A 7/1/18 B 7/1/18 A 8/1/18 C 8/1/18 D 8/1/18 A 9/1/18 C ...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi Anonymous,

     

    You can try to use following link if it suitable for your requirement:

    Comment =
    VAR currDate = 'Table'[Date]
    VAR currList =
        CALCULATETABLE (
            VALUES ( 'Table'[Usernames] ),
            FILTER (
                ALL ( 'Table' ),
                FORMAT ( [Date], "yyyymm" ) = FORMAT ( currDate, "yyyymm" )
            )
        )
    VAR prevList =
        CALCULATETABLE (
            VALUES ( 'Table'[Usernames] ),
            FILTER (
                ALL ( 'Table' ),
                [Date] < DATE ( YEAR ( currDate ), MONTH ( currDate ), 1 )
            )
        )
    VAR nextList =
        CALCULATETABLE (
            VALUES ( 'Table'[Usernames] ),
            FILTER (
                ALL ( 'Table' ),
                FORMAT ( [Date], "yyyymm" )
                    = FORMAT ( DATE ( YEAR ( currDate ), MONTH ( currDate ) + 1, 1 ), "yyyymm" )
            )
        )
    RETURN
        IF (
            COUNTROWS ( prevList ) > 0
                && NOT [Usernames] IN prevList,
            "New Added in " & FORMAT ( [Date], "mmm yyyy" ),
            IF (
                COUNTROWS ( nextList ) > 0
                    && NOT [Usernames] IN nextList,
                "Removed in " & FORMAT ( [Date], "mmm yyyy" ),
                "Nothing"
            )
        )
    

     

    Regards,

    Xiaoxin Sheng