Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
How can I compare the values between rows based on the values in other column. Example:
(Previous status is desired outcome)
| User | Year | Status | Previous Status |
A | 2019 | New | |
| A | 2020 | Active | New |
| A | 2021 | Idle | Active |
B | 2020 | New | |
B | 2021 | Deleted | New |
Thanks in advance
Solved! Go to Solution.
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
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!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 32 | |
| 31 | |
| 18 | |
| 12 | |
| 11 |