Forum Discussion
NadineNicolle
7 months agoRegular Visitor
New and Old Projects
Hi PowerBI experts! I am working on a visual that should show which new projects started, and which ones are gone and thus closed, compared with last month. The data is as follows: I have a m...
- 7 months ago
As I see it, you have 3 cases.
A - A project is New
B - A project is Ongoing
C - A Project is Closed
I would suggest breaking these out into a flag that says "Closed", "Ongoing", "Open" that you can then use in any visualisation, say, a table.
The calculated column could be created with this:Status =
VAR CurrentProjectID = 'Projects'[ProjectID]
VAR LatestMonth = MAX('Projects'[Date])
VAR FirstAppearance =
CALCULATE(
MIN('Projects'[Date]),
FILTER(
ALL('Projects'),
'Projects'[ProjectID] = CurrentProjectID
)
)
VAR LastAppearance =
CALCULATE(
MAX('Projects'[Date]),
FILTER(
ALL('Projects'),
'Projects'[ProjectID] = CurrentProjectID
)
)
VAR IsInLatestMonth = LastAppearance = LatestMonth
VAR IsFirstInLatestMonth = FirstAppearance = LatestMonth
RETURN
SWITCH(
TRUE(),
NOT(IsInLatestMonth), "Closed",
IsFirstInLatestMonth, "New",
"Ongoing"
)This assumes the table is called Projects, the ID is ProjectID, and the date is Date.
Test Data
Sample Output
Edit : correction of "Closed", "Ongoing", "Closed" to have one "Open"
krishnakanth240
7 months agoSuper User
Could you please share sample data to work on the logic you have shared. Thank You!
NadineNicolle
7 months agoRegular Visitor
Thanks for the reply, I already fixed it with the solution of JamieHolding !