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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Latest Comment per Task - wrong value upon Merge

Dear Community,

 

I have 2 tables, Tasks (one record for each task_id) and Time Item( multiple records for same task_id - that includes different comments added on different dates date_worked)

 

I need to bring the latest comment added against the task to the Task table. Unfortunately I can't use DAX, as I need all transformations done in Power Query, because I have a flow in Power Automte set up, that is programmed to export data into a CSV file.

 

In the Time Item table I have applied the following steps, that allowed me to filter the latest comment for each task, however when I merge this table with Task table, I see that other comments are asigned and not the latest.

 

#"Sorted Rows" = Table.Sort(#"Expanded wh_time_subitem",{{"task_id", Order.Ascending}, {"date_worked", Order.Descending}}),
#"GroupedTable"=Table.Group(#"Sorted Rows",{"task_id"},{{"LastItem",each Table.FirstN(_,1)}}),
#"Expanded LastItem" = Table.ExpandTableColumn(GroupedTable, "LastItem",

 

I really don't know what I am doing wrong, and it is frustrating to see that I have managed to select latest comment, but through the Merge step I am loosing the latest one, and a random one gets picked up.

 

Can you please help? Maybe there is anything else I can try? I have more experience in DAX so I am a bit lost.

 

Would really appreciate your help!

 

 

1 ACCEPTED SOLUTION
PwerQueryKees
Super User
Super User

Please allow us to help you and share

  • a sample of your data,
  • the result you are looking,
  • the result you are getting,
  • any relevant intermediate results and
  • ALL M code leading to those result (you mention a merge step giving the wron result, but I don't see it).

View solution in original post

2 REPLIES 2
PwerQueryKees
Super User
Super User

Please allow us to help you and share

  • a sample of your data,
  • the result you are looking,
  • the result you are getting,
  • any relevant intermediate results and
  • ALL M code leading to those result (you mention a merge step giving the wron result, but I don't see it).
Anonymous
Not applicable

Thanks for your reply. I have managed to complete this with the Group.max function. Thanks for your help

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

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.

Top Solution Authors