Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
vibhoryadav23
Helper II
Helper II

Multirow Formula in DAX

Hi,

 

How can I compare the values between rows based on the values in other column. Example:

(Previous status is desired outcome)

UserYearStatusPrevious Status

A

2019     New      
A2020     Active     New
A2021     Idle     Active

B

2020     New      

B

2021     Deleted     New

 

Thanks in advance

1 ACCEPTED SOLUTION
Jos_Woolley
Solution Sage
Solution Sage

Hi,

Calculated Column:

Previous Status =
VAR This_User = Table1[User]
VAR This_Year = Table1[Year]
VAR Previous_Year =
    CALCULATE(
        MAX( Table1[Year] ),
        FILTER(
            ALL( Table1 ),
            Table1[User] = This_User
                && Table1[Year] < This_Year
        )
    )
RETURN
    LOOKUPVALUE(
        Table1[Status],
        Table1[User], This_User,
        Table1[Year], Previous_Year
    )

Regards

View solution in original post

2 REPLIES 2
Jos_Woolley
Solution Sage
Solution Sage

Hi,

Calculated Column:

Previous Status =
VAR This_User = Table1[User]
VAR This_Year = Table1[Year]
VAR Previous_Year =
    CALCULATE(
        MAX( Table1[Year] ),
        FILTER(
            ALL( Table1 ),
            Table1[User] = This_User
                && Table1[Year] < This_Year
        )
    )
RETURN
    LOOKUPVALUE(
        Table1[Status],
        Table1[User], This_User,
        Table1[Year], Previous_Year
    )

Regards

Thanks Jos!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.