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
jaimemagana
New Member

Vlookup - PowerBI - Text range or list

Hi there!

 

I'm trying to obtain the license plate for a number of vehicles, based on how do their license pates end.

 

Original lookup table:

 

YearJanFebMarAprMAyJunJulAugSepOctNovDic
2022            
2021LMLLMXLNNLPDLPWLRPLSFLSPLTDLTPLVDLVV
2020LFHLFYLGGLGHLGPLHGLJDLJRLKFLKVLLJLMC
2019KTJKVBKVXKWTKXRKYNKZKKZYLBNLCGLCYLDR
2018KHGKHYKJVKKRKLNKMMKNKKPDKPSKRJKRZKSS
2017JWNJXFJYBJYTJZPKBMKCHKCTKDHKFCKFWKGN

 

(I did no copy the whole thing, for it is not necessary, that dates back to 2000, because it's not necessary)

 

When unpivoting the table to work with it, we obtains something like this (simplified for year 2021):

 

tbLookupPlateYear

YearMonth3LettersMonthNumber
2021DicLVV12
2021NovLVD11
2021OctLTP10
2021SepLTD09
2021AgoLSP08
2021JulLSF07
2021JunLRP06
2021MayLPW05
2021AbrLPD04
2021MarLNN03
2021FebLMX02
2021JanLML01

 

Now, lets obtain the plate date:

 

Example plate A:   E 1234 LSF

the date would be July 2021

 

Example plate B :  E 4321 LMM

The date would be between january and february 2021, so we state the lowest, january 2021

 

How can we do this in PowerBI? In Excel you would use vlookup, with no exact match, and it would work just fine. Not in PowerBI, that only outputs exact matches. 

 

Any ideas?

 

 

 

 

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @jaimemagana ,

 

You can convert the text to UniCode and then compare them.
1. First add a new column to table.

 

NumberCode = 
UNICODE ( 'Table'[3Letters] ) * 10000
    + UNICODE ( MID ( 'Table'[3Letters], 2, 1 ) ) * 100
    + UNICODE ( RIGHT ( 'Table'[3Letters] ) )

vkkfmsft_0-1643259570490.png

 

2. Then create the column in plate table.

 

Lookup = 
VAR Fir = UNICODE ( [3Letters] )
VAR Sec = UNICODE ( MID ( [3Letters], 2, 1 ) )
VAR Thir = UNICODE ( RIGHT ( [3Letters] ) )
VAR PlateUnicode = Fir * 10000 + Sec * 100 + Thir
VAR Tab =
    FILTER (
        'Table',
        'Table'[NumberCode]
            = MAXX ( FILTER ( 'Table', [NumberCode] <= PlateUnicode ), [NumberCode] )
    )
RETURN
    MAXX ( Tab, [Attribute] ) & " " & MAXX ( tab, [Year] )

vkkfmsft_1-1643259600712.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @jaimemagana ,

 

You can convert the text to UniCode and then compare them.
1. First add a new column to table.

 

NumberCode = 
UNICODE ( 'Table'[3Letters] ) * 10000
    + UNICODE ( MID ( 'Table'[3Letters], 2, 1 ) ) * 100
    + UNICODE ( RIGHT ( 'Table'[3Letters] ) )

vkkfmsft_0-1643259570490.png

 

2. Then create the column in plate table.

 

Lookup = 
VAR Fir = UNICODE ( [3Letters] )
VAR Sec = UNICODE ( MID ( [3Letters], 2, 1 ) )
VAR Thir = UNICODE ( RIGHT ( [3Letters] ) )
VAR PlateUnicode = Fir * 10000 + Sec * 100 + Thir
VAR Tab =
    FILTER (
        'Table',
        'Table'[NumberCode]
            = MAXX ( FILTER ( 'Table', [NumberCode] <= PlateUnicode ), [NumberCode] )
    )
RETURN
    MAXX ( Tab, [Attribute] ) & " " & MAXX ( tab, [Year] )

vkkfmsft_1-1643259600712.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

@jaimemagana , HI, would you share you excel vlookup solution for more clarity?

 

Regards,
John Basha Mattipati,
https://www.linkedin.com/in/john-basha-mattipati-06812980/

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.

Top Solution Authors
Top Kudoed Authors