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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
samihuq
Helper III
Helper III

Approximate Match for Date

Hi,

I have got two tables.

 

Table A:

 

Date Qty Rate
1-Jan-18 89 10
2-Jan-18 81 10
3-Jan-18 30 10
4-Jan-18 45 10
5-Jan-18 50 10
6-Jan-18 20 10
7-Jan-18 84 10
8-Jan-18 26 20
9-Jan-18 54 20
10-Jan-18 13 20
11-Jan-18 83 20
12-Jan-18 40 20
13-Jan-18 51 20
14-Jan-18 26 15
15-Jan-18 33 15
16-Jan-18 60 15
17-Jan-18 93 15
 

 

Table B:

 

Date Rate
1-Jan-18 10
8-Jan-18 20
14-Jan-18 15

 

Now I need to do an approximate match on Table B to get for column Rate in Table A. Can you please help me with the Dax formula?

 

Thanks,

Sami

1 ACCEPTED SOLUTION

Hi,

Actually Found the solution by ourselves>

 

Had to do two columns to achieve this, first find the approximate date [kind of vlookup true] and then find the corrosponding rate [kindof vlookup false]

 

Date 2 = CALCULATE(LASTNONBLANK(Rate[Date].[Date],1),FILTER(Rate,Rate[Date].[Date]<=Data[Date].[Date]))

 

and 

Rate = CALCULATE(SUM(Rate[Rate]),FILTER(Rate,Rate[Date].[Date]=Data[Date 2].[Date]))

 

Thanks,

Sami

View solution in original post

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @samihuq,

 

Do you want to compare the rate on the same day in TableA and TableB to check if they are matched? If so, you could use LOOKUPVALUE function to refer to 'TableA'[Rate] column in TableB.

 

New Column =
IF (
    TableB[Rate] = LOOKUPVALUE ( TableA[Rate], TableA[Date], TableB[Date] ),
    "Matched",
    "Not Matched"
)


Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

Actually Found the solution by ourselves>

 

Had to do two columns to achieve this, first find the approximate date [kind of vlookup true] and then find the corrosponding rate [kindof vlookup false]

 

Date 2 = CALCULATE(LASTNONBLANK(Rate[Date].[Date],1),FILTER(Rate,Rate[Date].[Date]<=Data[Date].[Date]))

 

and 

Rate = CALCULATE(SUM(Rate[Rate]),FILTER(Rate,Rate[Date].[Date]=Data[Date 2].[Date]))

 

Thanks,

Sami

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.