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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
APEREZ2
Advocate I
Advocate I

How to define if date is in a range

Hi,

I have the following problem. I need to relate the table of prices:

StartingPriceEndPriceProductUnit Price
2021-03-012021-05-22Apple Tree1.24
2021-05-232021-07-31Apple Tree1.54
2021-08-012022-04-01Apple Tree1.80
2021-03-012021-05-22Bonsai 2
2021-05-232021-07-31Bonsai 1.86
2021-08-012022-04-01Bonsai 1.79

With the sales tables, that contains an structure like this:

ProductQuantitySales Date
Apple Tree1232021-03-22
Bonsai2342021-05-09
Apple Tree1002022-01-22

How can I relate the two tables to obtain the Unit Price of each order. Because on Excel for me it's clear that with EndPrice column and XLOOKUP could be work, but on Power Query no.

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

Use below formula in a custom column in second table. First table is PriceTbl.

Table.SelectRows(PriceTbl, (x)=> x[StartingPrice]<=[Sales Date] and x[EndPrice]>=[Sales Date] and x[Product]=[Product]){0}[Unit Price]

  

View solution in original post

1 REPLY 1
Vijay_A_Verma
Super User
Super User

Use below formula in a custom column in second table. First table is PriceTbl.

Table.SelectRows(PriceTbl, (x)=> x[StartingPrice]<=[Sales Date] and x[EndPrice]>=[Sales Date] and x[Product]=[Product]){0}[Unit Price]

  

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors