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
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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors