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

View all the Fabric Data Days sessions on demand. View schedule

Reply
sebasj
Frequent Visitor

LOOKUPVALUE on the same table with conditions for the search and filters for the results

Hello everyone

 

I have a table with the following structure

 

idv1v2v3v4 (expected)
1aaXP
2aaYQ
3aaZ 
1baP 
2baQ 
3bbR 

 

As you can see, IDs are repeated. So,

- if for a given id, v2 = a, then I'd need a formula that searches for the id (on the same "id" column), and if there's a match and v2=b and v3=a, then retrieve the value in v3 to v4 into the row where v2=a.

 

I've filled V3 with the expected values because it's much easier to get an idea of the expected results rather than my poor explanation. I know it can be done by just duplicating the table, adding a relationship and using RELATED but I'd prefer not because the idea is that the tables are updated from a OneDrive location, so I'd need to duplicate the table in source, add several calculated columns, etc.

I tried to make a LOOKUP and a calculated column but I miserably failed, so any input will be more than welcomed.

 

Thanks in advance!

 

Best as always

Seb

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@sebasj , a new column

Try Like

if([V2] ="a", maxx(filter(Table, [ID] = earlier([ID]) && [V2] = earlier([V2]) && [V2] ="b" ), [V3]), blank())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@sebasj , a new column

Try Like

if([V2] ="a", maxx(filter(Table, [ID] = earlier([ID]) && [V2] = earlier([V2]) && [V2] ="b" ), [V3]), blank())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors