- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Merge in PowerQuery using filters and nearest values.
Hello I have an issue, which to abstract looks a bit like this:
Table 1: Inventory
ID | Item | Value |
1 | TV | £30 |
2 | TV | £40 |
3 | TV | £90 |
4 | Radio | £5 |
5 | Radio | £10 |
Table2: InsuranceProduct
Name | ProdType | MaxValue |
TVOne | TV | £50 |
TVTwo | TV | £100 |
RadioOne | Radio | £8 |
RadioTwo | Radio | £16 |
I want to merge these two queries so I can add a column to the Inventory table with the relevant insurance product name, i.e.:
ID | Item | Value | Insurance.Name |
1 | TV | £30 | TVOne |
2 | TV | £40 | TVOne |
3 | TV | £90 | TVTwo |
4 | Radio | £5 | RadioOne |
5 | Radio | £10 | RadioTwo |
I.e. in other words I want to look up a value in one table ([InsuranceProduct]"Name"), by matching on the value of one column ([Inventory]"Item" and [InsuranceProduct]"ProdType"), and finding the smallest value in [insuranceProduct]"MaxValue" that is greater than [Inventory]"Value"
I hope that makes sense!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

=let a=Table.Group(InsuranceProduct,"ProdType",{"n",each Table.Sort(_,"MaxValue")}) in Table.AddColumn(Inventory,"InsuranceName",each let b=a{[ProdType=[Item]]}?[n]? in if b=null then null else Table.Skip(b,(x)=>x[MaxValue]<[Value]){0}?[Name]?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

This seems to throw a cyclic reference error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

it works well on my PC

Helpful resources
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.
Power BI Monthly Update - June 2025
Check out the June 2025 Power BI update to learn about new features.

User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
7 | |
7 | |
6 |