Forum Discussion

LiamReidy's avatar
LiamReidy
Helper I
4 years ago
Solved

Timephased Data Resource Planning

Hi Power Bi Community,

 

I have a dataset in excel that keeps a record of roles within an organisation including the date range for each role and when a resource is available for the role. See small sample set below.

 

I want to create a line graph that shows 

 

line 1) Demand. Where the x axis is time and the y shows how many total staff are required for that day (using columns "post begins from date" and "post end date".

line 2) Capacity. Where the x axis is time and the y axis shows how many total staff are available for that day (using columns "resource available from date" and "post end date".

 

Expected Result: 

 

 

Sample Data:

 

 

 

 

DepartmentRole ReferencePost Beginning From DatePost End DateResource Available from Date
DEPT 1N000120/02/202330/03/202420/02/2023
DEPT 2N000215/05/202226/08/202315/05/2022
DEPT 3N000302/12/202226/08/202402/12/2022
DEPT 1N000401/05/202303/03/202501/05/2023
DEPT 2N000520/07/202305/12/202320/07/2023
DEPT 3N000621/08/202230/05/202405/09/2022
DEPT 1N000725/06/202202/02/202425/06/2022
DEPT 2N000824/03/202326/07/202324/03/2023
DEPT 3N000912/02/202321/07/202414/03/2023
DEPT 1N001024/09/202315/11/202324/09/2023
DEPT 2N001117/01/202331/08/202418/03/2023
DEPT 3N001223/03/202217/11/202323/03/2022
DEPT 1N001329/01/202204/07/202328/02/2022
DEPT 2N001430/03/202320/03/202414/04/2023
DEPT 3N001529/07/202203/11/202329/07/2022
DEPT 1N001621/01/202229/07/202221/04/2022
DEPT 2N001707/02/202222/11/202207/02/2022
DEPT 3N001810/08/202222/07/202310/08/2022
DEPT 1N001923/11/202313/12/202408/12/2023

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi LiamReidy ,

    You can refer the following links to achieve it.

    Total Number Of Staff Over Time - Power BI Insights

    Calculating Employee Attrition with DAX

    1. Create one if there is no date dimension table in your model

    2. Create a similar measure as below to get the number of available staff and required staff

    Number of available staff =
    VAR _seldate =
        SELECTEDVALUE ( 'Date'[Date] )
    RETURN
        CALCULATE (
            DISTINCTCOUNT ( 'table'[staffid] ),
            FILTER (
                'table',
                'table'[post begins from date] <= _seldate
                    && 'table'[post end date] > _seldate
            )
        )

    3. Create a line chart (Axis: Date field of Date dimension table  Values: measures)

    If the two links above don't help you get the results you want, could you please provide more sample data (containing staff information, relationships between tables, etc.), the logic of the calculation (how the Demand and Capacity are obtained). It seems that the table data you provided before contains staff information. By the way, what is the real start date column used for? If possible, could you please give me an example of the final result you want based on the existing example data and the calculation logic. Thank you.

    Best Regards

4 Replies

    • LiamReidy's avatar
      LiamReidy
      Helper I

      thank you, i will try this. Still a bit confused how to apply it as your example shows "start date" and "end date." In my example, i have an extra column "real start date." how do i apply this extra field to show "start date to end date" vs "actual start date" vs "end date." 

       

      Also, in my example would i replace employee table and employee id with "job/role" table and "job/role id?"

       

      NB: in my example, start date and end date will be fixed, but real start date will vary based on when a suitable employee is found for the role.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi LiamReidy ,

    You can refer the following links to achieve it.

    Total Number Of Staff Over Time - Power BI Insights

    Calculating Employee Attrition with DAX

    1. Create one if there is no date dimension table in your model

    2. Create a similar measure as below to get the number of available staff and required staff

    Number of available staff =
    VAR _seldate =
        SELECTEDVALUE ( 'Date'[Date] )
    RETURN
        CALCULATE (
            DISTINCTCOUNT ( 'table'[staffid] ),
            FILTER (
                'table',
                'table'[post begins from date] <= _seldate
                    && 'table'[post end date] > _seldate
            )
        )

    3. Create a line chart (Axis: Date field of Date dimension table  Values: measures)

    If the two links above don't help you get the results you want, could you please provide more sample data (containing staff information, relationships between tables, etc.), the logic of the calculation (how the Demand and Capacity are obtained). It seems that the table data you provided before contains staff information. By the way, what is the real start date column used for? If possible, could you please give me an example of the final result you want based on the existing example data and the calculation logic. Thank you.

    Best Regards