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
PetrP
Frequent Visitor

Lookup for value based on sorted mapping table

Hi,

I have been solving the categorization case for some time. The case is therefore:

 

I have an mapping table (MapTable) where the order is important.

 

KeywordBrandIndex
e-tronElectric CAR0
sportbackSport CAR1
Q6SUV2
4xFourCross CAR3
citycarverCity CAR4

 

Also I have Product Table (Products).

Product
A1_citycarver_s-tronic_e-tron
A1_citycarver_s-tronic_TSI
A1_citycarver_s-tronic_TSI_4x
A6_sportback_s-tronic_TSI_4x
A6_avant_s-tronic_TSI_4x
Q6_sportback_s-tronic_TSI_4x
Q6_avant_s-tronic_TSI_e-tron
Q6_family_s-tronic_TSI_4x

 

Based on keyword from MapTable I need to assign Brand. As is known, LOOKUPVALUE function works with native sorting, you cannot specify another column in MapTable for sorting. So after using this function you get wrong Brand values. 

Brand = 
LOOKUPVALUE(MapTable[Brand],MapTable[Keyword],FIRSTNONBLANK(FILTER(VALUES(MapTable[Keyword]),SEARCH(MapTable[Keyword],Products[Product],1,0)),1))

 Second option I often use is that I am using all columns in filter, then I also need to get only specified column result as "search_value".

Brand Sorted = 
LOOKUPVALUE(MapTable[Brand],MapTable[Keyword],SELECTCOLUMNS(FIRSTNONBLANK(FILTER(VALUES(MapTable),SEARCH(MapTable[Keyword],Products[Product],1,0)),1),"search_value",MapTable[Keyword]))

 I hope the second option works, but does anyone have any other solution?

 

The result seems like:

PetrP_0-1618351427553.png

 

Your feedback is welcome!

Thank you,

Petr

2 REPLIES 2
amitchandak
Super User
Super User

@PetrP , Not very clear to me.

 

You can also try like

Minx(filter(MapTable, SEARCH(MapTable[Keyword],Products[Product],,0)>0),MapTable[Brand])

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

@amitchandak  Your formula just searching by native search, not based on search keyword ranking (index).

 

This means I need to use such a mechanism that iterate all keywords in MapTable row by row by Index rank. E.g..: search e-tron, if not found then search sportback etc.. If any keyword is searched, use the Brand column.

Helpful resources

Announcements
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.

June 2025 community update carousel

Fabric Community Update - June 2025

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