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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
topazz11
Helper III
Helper III

Lookup and return value at each level

Hello,

 

I want to create a new table that has a column which lookups and returns each value at each level from lookup table.

Is it possible to do this using Power Query?

 

Thank you

 

help.JPG

 

help2.JPG

1 ACCEPTED SOLUTION

Hi @topazz11 

 

I don't think I completely understand your logic...you have different comparison for Type and Model, here is the original way with your first sample data

View solution in original post

4 REPLIES 4
Vera_33
Resident Rockstar
Resident Rockstar

Hi @topazz11 

 

What is the logic when you do lookup? I tried different ways, but never came up what you wanted. If Limit <= Amount, then

Vera_33_0-1637652959812.png

I have a table called LookupTable. And pls do provide the logic and sample data in a format which people can copy in the future

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTIxNTBQitWJVnICcoyNoRxnIMfIEMpxAXIsQexYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product = _t, Amount = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Product", type text}, {"Amount", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", (x)=> Table.SelectRows(LookupTable, each  Number.From(Text.Select( [Limit],{"0".."9"}))<=  x[Amount])),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Level", "Name"}, {"Level", "Name"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Custom", each ([Level] <> null)),
    #"Pivoted Column" = Table.Pivot(#"Filtered Rows", List.Distinct(#"Filtered Rows"[Level]), "Level", "Name")
in
    #"Pivoted Column"

 

pbi

 

here is the pbix file i was working on..

Hi @topazz11 

 

I don't think I completely understand your logic...you have different comparison for Type and Model, here is the original way with your first sample data

Hello @Vera_33 

 

The logic is just the amount fall under the limit so if the amount is 2100 then it can go up to the limit 3000.

your screen shot looks correct...can you show me the lookup table you used?

 

Thank you! 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.