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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
chengo555
New Member

Retrieve last entry by group

 

Hi there,

 

I hope that you are able to help me with my problem.

In the example table below, I am trying to calculate Column D where I’d like to display the latest “Process Date” (Column C) for each “Project ID” (Column A).

In other words, all Project ID rows should display 19th of November 2018 in Column 4.

I tried LOOKUPVALUE and CALCULATE functions but haven’t been able to get this to work.

 

Any advice is most welcome!

 

Project IDFinal TotalProcess DateRequired Result
1100015/05/201819/11/2018
1150027/09/201819/11/2018
1200019/11/201819/11/2018
250013/07/201821/09/2018
275021/09/201821/09/2018
325023/02/201825/12/2018
350017/06/201825/12/2018
390025/12/201825/12/2018
1 ACCEPTED SOLUTION

No worries. You can just add the filter on Category back in after the ALLEXCEPT

 

Final Date =
CALCULATE (
    MAX ( Project[Process Date] ),
    ALLEXCEPT ( Project, Project[Project ID] ),  //Removes all contexts/filters except for Project ID
    Project[Category] = "Rock" //Adds back in a filter on category
)

2018-12-13 08_41_16-new scratchpad - Power BI Desktop.png

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

This type of thing is perfect for Power Query.  Here's the final table I got:

Final PQ Table.png

 

You can see what I did in Power Query and the applied steps.

 

Here is the file:

https://1drv.ms/u/s!AoQIGRpzoxRH-j2KMwlHc95qrZbC

Hi, the link to the workbook is invalid. Can you please share again?

Hi, the link to the workbook is invalid. Can you please share again?

dedelman_clng
Community Champion
Community Champion

Try this:

 

Final Date = 
 CALCULATE(
     MAX(Project[Process Date]),
     ALLEXCEPT(Project, Project[Project ID])
)

2018-12-12 11_26_24-new scratchpad - Power BI Desktop.png

 

Hope this helps

David

Hi David,
 
Thanks for the solution. It works exactly with the given scenario. Unfortunately for me I did not represent my problem correctly.
Actually there is another column that must be taken into account when calculation the results.
Clarified problem statement:
Display latest "Process Date" where "Category" = Rock for each "Project ID".
My apologies for missing this additional requirement earlier.
 
Thank you so much for looking into this!
 
Project IDCategoryFinal TotalProcess DateRequired Result
1Rock100015/05/201819/11/2018
1Paper150027/09/201819/11/2018
1Rock200019/11/201819/11/2018
2Rock50013/07/201813/07/2018
2Paper75021/09/201813/07/2018
3Rock25023/02/201817/06/2018
3Rock50017/06/201817/06/2018
3Scissors90025/12/201817/06/2018

No worries. You can just add the filter on Category back in after the ALLEXCEPT

 

Final Date =
CALCULATE (
    MAX ( Project[Process Date] ),
    ALLEXCEPT ( Project, Project[Project ID] ),  //Removes all contexts/filters except for Project ID
    Project[Category] = "Rock" //Adds back in a filter on category
)

2018-12-13 08_41_16-new scratchpad - Power BI Desktop.png

Hi David,

 

Thank you very much for the solution! It works exactly as required.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

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