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
meepx
New Member

Approximate lookup of closest values

Hi Power BI Genius,

 

I'm having difficulty creating a DAX measure to retrieve approximate values from the two tables provided below.

 

Using the average cost of products sold in Table 2, I aim to find the shipment number with the closest unit cost received and the most recent shipment date received (if the unit costs received are the same in multiple shipments) from Table 1. 

 

Does anyone experience in creating something similar like this?

 

Table 1   
Shipment NumberShipment Date ReceivedProductUnit Cost Received
10005/12/2023A5.83
10011/01/2024B10.13
10022/03/2024C18.43
100318/02/2024B10.54
100417/02/2024C18.23
100529/02/2024A5.83
100610/04/2024B10.45
100715/04/2024C18.39
100820/05/2024A5.8

 

Table 2 
ProductAverage Cost sold
A5.825
B10.5
C18.23

 

Result wanted:

   
ProductAverage Cost soldApproximate Search for Shipment
A5.8251005
B10.51003
C18.231004
1 ACCEPTED SOLUTION
ThxAlot
Super User
Super User

ThxAlot_0-1716321242527.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

1 REPLY 1
ThxAlot
Super User
Super User

ThxAlot_0-1716321242527.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



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.