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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Find postcalcode in between range and lookup value based on second value

Hi,

 

Currently working on a case where I need to calculate estimated delivery and pickup times. Need to extract the leadtimes per postalcode/Transport Type to calculate this. I can't work with a key as I need to lookup a value in a range of table instead of an identical unique value in another table.

 

This is my table with orderdata:

 

Sofien1234_0-1654672764535.png

 

I want to add a column with latest pick-up time. Therefore I need to include a column which displays the leadtime per order on every row.

 

This is my table with leadtime data:

 

Sofien1234_1-1654672929282.png

 

So for example, lets take the first order from the image. This has postal code = AT1230 and D.S.T = U14. So lookup leadtimes where (Table1.[D.S.T]) = (Table2.[TT]) and find postal code AT1230 in between range from (Table2.[FromZip]) and (Table2.[ToZip]).

 

I think this is a very complex one to calculate but maybe there is an expert out there who knows the solution.

 

Thanks in advance.

 

Kind Regards,

 

Sofiën

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Found the solution for it with following column:

 

LeadtimeCalculation = LOOKUPVALUE('LeadTime'[Leadtime],Leadtime[TT code],G002[D.S.T]
,CALCULATE ( SELECTEDVALUE ( LeadTime[Leadtime] ),
FILTER (
LeadTime,
LeadTime[From] <= 'G002'[Zip Code]
&& LeadTime[To] >= 'G002'[Zip Code]
),FILTER(Leadtime, Leadtime[TT code] = 'G002'[D.S.T])
))

 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Found the solution for it with following column:

 

LeadtimeCalculation = LOOKUPVALUE('LeadTime'[Leadtime],Leadtime[TT code],G002[D.S.T]
,CALCULATE ( SELECTEDVALUE ( LeadTime[Leadtime] ),
FILTER (
LeadTime,
LeadTime[From] <= 'G002'[Zip Code]
&& LeadTime[To] >= 'G002'[Zip Code]
),FILTER(Leadtime, Leadtime[TT code] = 'G002'[D.S.T])
))

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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 Solution Authors
Top Kudoed Authors