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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Kudoed Authors