March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have a table that looks like the one below. Each entry is a single project.
Client Name | Project Entry Date | Project Completed Date | Ageing in Days | Project Status |
Client A | 22/01/2019 | 01/04/2019 | 69 days | Completed |
Client B | 13/07/2020 | Ongoing | ||
Client C | 17/06/2021 | 19/092021 | 103 days | Completed |
Client D | 21/09/2021 | 29/09/2021 | 8 days | Completed |
Client E | 23/10/2021 | 06/01/2022 | 74 days | Completed |
CLient F | 27/01/2022 | Ongoing |
So I want to get the number of days of an ongoing project that has stayed the most. That project would probably be the one for Client B since it does not have a completed date and is the earliest.
I am thinking Datediff would work with and then get a value of the highest using RankX , DENSE. I want to display that number of days on a card. Any assistance is highly appreciated.
Solved! Go to Solution.
Oldest project =
VAR __Date = CALCULATE (
MIN ( 'Table'[Entry Date] ),
FILTER (
'table',
'table'[Status] <> "completed"
&& 'table'[Status] <> "removed"
&& 'table'[Status] <> "cancelled"
)
)
RETURN
DATEDIFF( __Date, TODAY(), DAY)
How about this:
Oldest =
VAR __Days =
MAXX (
'Table',
IF (
ISBLANK ( 'Table'[Completed Date] ),
DATEDIFF ( 'Table'[Entry Date], TODAY (), DAY ),
DATEDIFF ( 'Table'[Entry Date], 'Table'[Completed Date], DAY )
)
)
RETURN
__Days
Thanks for this. However, it is somewhat not correct from my side's explanation. I have been able to extract a date with the oldest date of an ongoing project. The formula used is as follows.
Oldest project =
CALCULATE (
MIN ( 'table'[entry_date] ),
FILTER (
'table',
'table'[Status] <> "completed"
&& 'table'[Status] <> "removed"
&& 'table'[Status] <> "cancelled"
)
)
how can I subtract this date from today's Date using Today()? @Adescrit
Oldest project =
VAR __Date = CALCULATE (
MIN ( 'Table'[Entry Date] ),
FILTER (
'table',
'table'[Status] <> "completed"
&& 'table'[Status] <> "removed"
&& 'table'[Status] <> "cancelled"
)
)
RETURN
DATEDIFF( __Date, TODAY(), DAY)
In my answer, it returns a blank. Not sure why. Thanks, though
Finally it works
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
User | Count |
---|---|
93 | |
87 | |
84 | |
76 | |
49 |
User | Count |
---|---|
163 | |
148 | |
103 | |
74 | |
55 |