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
EllieSU
Regular Visitor

How do I match a review file to its correct reporting month based on data from 2 tables?

Hi all, I need help figuring out the best way to match a completed report to its correct reporting month.

 

I have tried using lookupvalue. The issue I have is that I cannot match Reporting Month to Review Completed as some reviews can be completed in later months. What would be the best approach to this? 

 

For both tables, there is no unique id as some of them can be repeated.

 

For example there a list of review to be complete by employee with reporting month (Table 1).

Reporting MonthReview File NameEmployee Assigend
November 2023ABCEmployee A
November 2023DEFEmployee B
November 2023GHIEmployee C
November 2024ABCEmployee A
November 2024DEFEmployee D
November 2024JKLEmployee C

 

 Then we have another table (Table 2) that only shows the date the review is completed, review file name, and employee assigned.

Review CompletedReview File NameEmployee Assigned
15 December 2023ABCEmployee A
10 November 2023DEFEmployee B
5 Jan 2024GHIEmployee C
23 November 2024ABCEmployee A
10 December 2024DEFEmployee D
12 November 2024JKLEmployee C

 

The deired output is having the Reporting Month from Table 1 added to Table 2:

Review CompletedReview File NameEmployee AssignedReporting Month
15 December 2023ABCEmployee ANovember 2023
10 November 2023DEFEmployee BNovember 2023
5 Jan 2024GHIEmployee CNovember 2023
23 November 2024ABCEmployee ANovember 2024
10 December 2024DEFEmployee DNovember 2024
12 November 2024JKLEmployee CNovember 2024
2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

 

@EllieSU 

you can create a new column in table 1 and change it to date

11.PNG

 

then use DAX to create a column

 

Column =
 VAR _date=maxx(FILTER('Table 1','Table 1'[Reporting Month - Copy]<='Table  2'[Review Completed]),'Table 1'[Reporting Month - Copy])
 return maxx(FILTER('Table 1','Table 1'[Reporting Month - Copy]=_date),'Table 1'[Reporting Month])
 
12.PNG
 
 
pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

Reporting month = FORMAT(CALCULATE(MAX(Table1[Reporting Month]),FILTER(Table1,Table1[Employee Assigend]=EARLIER(Table2[Employee Assigned])&&Table1[Review File Name]=EARLIER(Table2[Review File Name])&&Table1[Reporting Month]<=EARLIER(Table2[Review Completed]))),"mmmm-yyyy")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

Reporting month = FORMAT(CALCULATE(MAX(Table1[Reporting Month]),FILTER(Table1,Table1[Employee Assigend]=EARLIER(Table2[Employee Assigned])&&Table1[Review File Name]=EARLIER(Table2[Review File Name])&&Table1[Reporting Month]<=EARLIER(Table2[Review Completed]))),"mmmm-yyyy")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

 

@EllieSU 

you can create a new column in table 1 and change it to date

11.PNG

 

then use DAX to create a column

 

Column =
 VAR _date=maxx(FILTER('Table 1','Table 1'[Reporting Month - Copy]<='Table  2'[Review Completed]),'Table 1'[Reporting Month - Copy])
 return maxx(FILTER('Table 1','Table 1'[Reporting Month - Copy]=_date),'Table 1'[Reporting Month])
 
12.PNG
 
 
pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @ryan_mayu, If you don't mind, can you explain the logic behind that as well? Thanks so much

@EllieSU 

first to create a date column, only date can compare with data. Then we find the max date before the review complete data, the report month related to that max date is what we want to get.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.