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
rlymer
Frequent Visitor

Power Query for Calculated Column - Last Review Date

I have 2 tables, Task and Review. Task has TaskID as a primary key, and Review has TaskID as a foreign key. Each Task can have multiple Reviews.

 

I am wanting a column in the Task table to show the latest Review date, or null if there has been no review. Can anyone point me in the right direction in terms of the power query?

 

Thanks

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @rlymer 

 

Download example PBIX file

 

I know you have posted in the PQ forum but I think this is better off done in DAX as you don't have to add a new column to your dataset. And it'll be faster than doing a table joins if your data set is large.

 

Try this measure

Latest Review Date = CALCULATE(MAX('Review'[Review Date]), FILTER('Task', 'Task'[TaskID] = SELECTEDVALUE('Task'[TaskID])))

 

On this Review table

reviewtab.png

 

Giving this (the TaskID column is set to show items with no data)

 

taskid.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

3 REPLIES 3
PhilipTreacy
Super User
Super User

Hi @rlymer 

 

Download example PBIX file

 

I know you have posted in the PQ forum but I think this is better off done in DAX as you don't have to add a new column to your dataset. And it'll be faster than doing a table joins if your data set is large.

 

Try this measure

Latest Review Date = CALCULATE(MAX('Review'[Review Date]), FILTER('Task', 'Task'[TaskID] = SELECTEDVALUE('Task'[TaskID])))

 

On this Review table

reviewtab.png

 

Giving this (the TaskID column is set to show items with no data)

 

taskid.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


@PhilipTreacy Thank you, this works great. I had to explicitly state the relationship with USERELATIONSHIP as in my model it was an inactive relationship.

wdx223_Daniel
Super User
Super User

NewStep=Table.TransformColumns(Table.NestedJoin(Task,"TaskID",Review,"TaskID","LastReviewDate",JoinKind.LeftOuter),{"LastReviewDate",each if _ is table then List.Max([ReviewDate]) else null})

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.