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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
jp_comms
New Contributor

How to lookup different criteria and return results from another columns

Hi Everyone,

 

I'm trying to get the results of the following. but got stuck using lookup. any suggestions please.

Whenever source file is refreshed daily, aging for each Invoice ID are also updated.

 

From the latest report date, I will Look up "Invoice ID and Aging" from previous Report Date and using Updated Invoice ID and Aging. if found, return the Invoice ID and aging.

Table sample data.png

 

 

Invoice ID and AgingUpdated Invoice ID and AgingReport DateResult
21227365-1Past Due 03/08/2025 
21215357-1Current21215357-1Past Due03/08/2025 
21227359-1Current21227359-1Past Due03/08/2025 
21228458-1Future21228458-1Current03/08/2025 
21228437-1Current21228437-1Current03/08/2025 
21228456-1Future21228456-1Future03/08/2025 
21227365-1Past Due 03/08/2025 
21215357-1Past Due21215357-1Past Due04/08/202521215357-1Past Due
21227359-1Past Due21227359-1Past Due04/08/202521227359-1Past Due
21228458-1Current21228458-1Past Due04/08/202521228458-1Current
21228437-1Current21228437-1Current04/08/202521228437-1Current
21228456-1Current21228456-1Future04/08/202521228456-1Current
21228453-1Current 04/08/2025blank
21228472-1Current 04/08/2025blank
21228459-1Current 04/08/2025blank
21228485-1Current 04/08/2025blank
21228454-1Current 04/08/2025blank
21228471-1Current 04/08/2025blank

 

Thank you

1 ACCEPTED SOLUTION
GeraldGEmerick
Contributor

@jp_comms I believe something like this should work:

Column = 
VAR _ReportDate = [Report Date]
VAR _InvoiceIDandAging = [Invoice ID and Aging]
VAR _Return = CALCULATE( MAX( 'Table'[Updated Invoice ID and Aging] ), FILTER( 'Table', 'Table'[Report Date] < _ReportDate && [Updated Invoice ID and Aging] = _InvoiceIDandAging ) )
RETURN _Return

View solution in original post

2 REPLIES 2
GeraldGEmerick
Contributor

@jp_comms I believe something like this should work:

Column = 
VAR _ReportDate = [Report Date]
VAR _InvoiceIDandAging = [Invoice ID and Aging]
VAR _Return = CALCULATE( MAX( 'Table'[Updated Invoice ID and Aging] ), FILTER( 'Table', 'Table'[Report Date] < _ReportDate && [Updated Invoice ID and Aging] = _InvoiceIDandAging ) )
RETURN _Return
jp_comms
New Contributor

thank you so much, it worked! ๐Ÿ˜‰

Helpful resources

Announcements
Top Solution Authors
Users online (8,586)