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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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
Solution Sage
Solution Sage

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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