Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Using a slicer to compare two rows in the same table

I have a series of records with unique IDs, and I'm creating monthly snapshots of these records with a generic text description field in place. Something like:   Record Date Comments A Mar...
  • v-jingzhang's avatar
    v-jingzhang
    4 years ago

    Hi Anonymous

     

    Thank you for the explanation. Based on the sample data, you can create below measure.

    Current Comment = 
    VAR maxDate = CALCULATE(MAX(Record_Table[Date]),ALL(Record_Table))
    VAR currentComment = CALCULATE(MAX(Record_Table[Comments]),ALLEXCEPT(Record_Table,Record_Table[Record]),Record_Table[Date]=maxDate)
    VAR initialComment = SELECTEDVALUE(Record_Table[Comments])
    RETURN
    IF(currentComment = initialComment,BLANK(),currentComment)

     

    Put Date column into a slicer. Put Record, Comments and above measure into a table visual. Comments column will show comments on a selected initial date. You can rename Comments column for this table visual specificially. 

    Let me know if you have any questions.

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.