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
ThomasWeppler
Skilled Sharer
Skilled Sharer

Number of open projects between open and close date at any date

I want to figure out how many project are open at any given time.

I define open as a project that has been started and not been closed yet.

 

What I have

A column with project id for all projects.

A  column with start date for all the projects

A column with closed date for all the closed projects and the date 01/01/1970 for all the projects that has not been closed yet.

All this info is in the same table

 

What I try to get

I want to figure out how many projects was open at any given date and which projects. The end user need to be able to pick the dates. I imagen a diagram that goes up all days where the number of open projects are higher and goes down whenever a project is closed. I also imagen that you can figure out which projects was open at any given day. This will be used for further analysis of which project leaders are busy, hwich customers is helped etc.

I am not sure if it is best to make it as a measure or a new column.

All feedback will be greatly appreciated.

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @ThomasWeppler 

1. Create a date table. No relationships for the time being

2. Place DateT[Date] in the x axis of a (line) chart. If necessary create a slicer to select date ranges to show.

3. Create this measure and place it in Values of the chart:

Num open projects =
VAR currentDate_ = MAX ( DateT[Date] )
VAR closedProjectDate_ = DATE ( 1970, 1, 1 )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Table1[ ProjectID] ),
        Table1[StartDate] <= currentDate_,
        FILTER (
            ALL ( Table1[EndDate] ),
            Table1[EndDate] > currentDate_
                || Table1[EndDate] = closedProjectDate_
        )
    )

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

3 REPLIES 3
ThomasWeppler
Skilled Sharer
Skilled Sharer

Thanks a lot AIB and Amitchandak.

I will take a closer look at your answers and see if I can solve my problem with your feedback.

AlB
Super User
Super User

Hi @ThomasWeppler 

1. Create a date table. No relationships for the time being

2. Place DateT[Date] in the x axis of a (line) chart. If necessary create a slicer to select date ranges to show.

3. Create this measure and place it in Values of the chart:

Num open projects =
VAR currentDate_ = MAX ( DateT[Date] )
VAR closedProjectDate_ = DATE ( 1970, 1, 1 )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Table1[ ProjectID] ),
        Table1[StartDate] <= currentDate_,
        FILTER (
            ALL ( Table1[EndDate] ),
            Table1[EndDate] > currentDate_
                || Table1[EndDate] = closedProjectDate_
        )
    )

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

amitchandak
Super User
Super User

@ThomasWeppler , see if my blog on similar topic help. You need to add code to handle the close date 01/01/1970 

 

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

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.