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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Hasan_iba
Helper II
Helper II

Finding Most Recent Date of Each Projects

Hello Power BI experts. Hope all of you are doing well. I am facing an issue which is summarized as follows: 

I have a project management dataset which includes project name, history date and project health (which shows the status of the project: Green, Red or Yellow). I need to find the most recent date of each of the project and then extract the status of the project on that most recent date. The following image should clarify: 

Untitled.png

For example, for Apparel ERP project, the most recent date is 5/9/2007. For other projects, most recent projects may be other dates such as 5/3/2017....5/2/2017 and so on. I want to find the most recent dates for each of the projects and based on that date, i need to find the project health status. I tried to use last date function but showing error. 

I need to highlight the most recent project status with colored indicators like the following snap: 

Untitled.png

 

I have figured out the historic health status which shows the status of a project on a specific date selected. 

Here is a summary of what i need to find (As my post has got a bit lengthy. So, giving a sum up)

1. I am looking to find the most recent date for each of the projects

2. Based on the most recent date, I want to find the status of the project 

3. I want to indicate the status of project for most recent date with colored indicator. 

Here is the pbix file i am working with: https://drive.google.com/file/d/0B0XwYvmbIN12REpUVXRGbG1ickU/view?usp=sharing

 

A solution will be highly appreciated. Thanks a lot

Hasan

 

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

Hi @Hasan_iba,

Create the MaxDate measure and “Is Latest“ column in your table using the following DAX.

MaxDate = CALCULATE(MAX(HistoryCompare[HistoryDate]), ALL(HistoryCompare))
Is Latest = if(HistoryCompare[HistoryDate] = [MaxDate], "Latest", "")

Then create a table visual as shown in the screenshot below, drag “Is Latest“ column to visual level filters and filter it to “Latest”.


1.PNG

Additionally, regarding to the color indicator issue, please review smoupre’s reply in your another thread.

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yuezhe-msft
Employee
Employee

Hi @Hasan_iba,

Create the MaxDate measure and “Is Latest“ column in your table using the following DAX.

MaxDate = CALCULATE(MAX(HistoryCompare[HistoryDate]), ALL(HistoryCompare))
Is Latest = if(HistoryCompare[HistoryDate] = [MaxDate], "Latest", "")

Then create a table visual as shown in the screenshot below, drag “Is Latest“ column to visual level filters and filter it to “Latest”.


1.PNG

Additionally, regarding to the color indicator issue, please review smoupre’s reply in your another thread.

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

What if the latest date for every product varies from one another? Because I have realized that i Hassan's example, the most recent date for each "Name" is 5/9/2017. What if product "A" most recent date is 5/9/2017 and for product "B" is 17/12/2018? I have tried the DAX you provided Lydia and it does not work when the most recent dates are different for each product.

 

Many thanks!

Anonymous
Not applicable

I'd suggest making calculated column called "Current Health" and using LASTNONBLANK.  You could use this in a formula to only consider records that share the "Name" column.

Hi @Anonymous can you provide some details on how to use the lastnonblank formula? What should be the inputs? Thanks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.