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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
uc
Helper II
Helper II

Performing case sensitive lookup in power bi

Hello

 

I am having issues while doing lookup because the lookup value is case sensitive in Power BI. I will explain it with an example. Please see the example below. Any ideas is much appreciated. THanks.

Table 1

CodeColour
AxPWhite
tmuBlue
TMuBlack

Table 2

ItemCodeColour (I need to get the right colur by doing a lookup from the code column in table 1)
LampTMuBlack
TabletmuBlue
MugAxPWhite
2 ACCEPTED SOLUTIONS
MasonMA
Resident Rockstar
Resident Rockstar

@uc 

 

Hi, i'd suggest making them consistent first in Power Query. 

 

For example in Power Query add one more step to both Table1 and Table2, then do a merge on "Code". 

= Table.TransformColumns( #"PreviousStep", {{"Code", Text.Upper, type text}} // or Text.Lower )

 

If you wanted to skip Power Query transformation, try this with DAX: 

LOOKUPVALUE( Table1[Colour], UPPER(Table1[Code]), UPPER(Table2[Code]) )

View solution in original post

johnt75
Super User
Super User

This is not possible in DAX as the values are stored in a case insensitive way. To accomplish it you will need to perform transformations before the data is loaded. Ideally you would do something at the source but it is also possible in Power Query, but doing it in Power Query would significantly slow down data refresh if you have a lot of data.

The approach I would take, either in Power Query or in SQL, would be add a unique integer identifier to table 1. In Power Query you could add an Index column for this purpose.

The query pulling table 2 would then need to map the existing code value to the integer and store the integer. You can then use the integer columns to create a relationship, look up values etc.

View solution in original post

6 REPLIES 6
uc
Helper II
Helper II

Thankyou. It works.

johnt75
Super User
Super User

This is not possible in DAX as the values are stored in a case insensitive way. To accomplish it you will need to perform transformations before the data is loaded. Ideally you would do something at the source but it is also possible in Power Query, but doing it in Power Query would significantly slow down data refresh if you have a lot of data.

The approach I would take, either in Power Query or in SQL, would be add a unique integer identifier to table 1. In Power Query you could add an Index column for this purpose.

The query pulling table 2 would then need to map the existing code value to the integer and store the integer. You can then use the integer columns to create a relationship, look up values etc.

Thanks Mason and John for the idea.

This is correct, thanks for pointing this out 

tayloramy
Community Champion
Community Champion

Hi @uc

I agree with @MasonMA

Normalize your values in PQ and then don't waste run-time compute on tyring to do case sensitive nonsense. 

 

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, please mark this as the solution. 

MasonMA
Resident Rockstar
Resident Rockstar

@uc 

 

Hi, i'd suggest making them consistent first in Power Query. 

 

For example in Power Query add one more step to both Table1 and Table2, then do a merge on "Code". 

= Table.TransformColumns( #"PreviousStep", {{"Code", Text.Upper, type text}} // or Text.Lower )

 

If you wanted to skip Power Query transformation, try this with DAX: 

LOOKUPVALUE( Table1[Colour], UPPER(Table1[Code]), UPPER(Table2[Code]) )

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.