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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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.LeanAndPractise(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.LeanAndPractise(Everyday)


)



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.