Forum Discussion

NP2020's avatar
NP2020
Frequent Visitor
5 years ago
Solved

Comparing two tables with time data - forecast versus actuals

Hello -

I am looking for some assistance with visualising some timesheet data.

I am trying to visualise the hours planned for activities on our project against what was actually booked. I have created some dummy data to demonstrate what I am looking to acheive.

I have two tables, one containing a plan of activities, assigned to resources, with a time allocated to the activity on a series of dates.

DateStaff NumberNameActivityForecast HoursRateForecast Cost
01/02/20211LukeUse force550250
01/02/20211LukeLightsabre practice350150
01/02/20212HanShoot First16565
01/02/20212HanRescue Princess765455
02/02/20211LukeUse force550250
02/02/20211LukeLightsabre practice350150
02/02/20212HanAvoid Jabba865520
03/02/20212HanAvoid Jabba865520
04/02/20211LukeUse force550250
04/02/20211LukeLightsabre practice350150
04/02/20212HanShoot First265130
04/02/20212HanAvoid Jabba665390
05/02/20211LukeUse force850400
05/02/20212HanRescue Princess365195
05/02/20212HanAvoid Jabba565325

The other table is the "actuals", where resources have recorded in our timesheet system what activities they have worked on, for how long. There are no restrictions as to what activities they can record in the system, even if they are not forecasted to do so (which is part of the reason I am looking to visualise this data). Resources can also book more or less hours than required. An example of the actuals data is below:

DateStaff NumberNameActivityActual HoursRateActual Cost
01/02/20211LukeUse force450200
01/02/20211LukeLightsabre practice250100
01/02/20212HanShoot First16565
01/02/20212HanRescue Princess665390
02/02/20211LukeAvoid Jabba650300
02/02/20211LukeLightsabre practice250100
02/02/20212HanAvoid Jabba765455
03/02/20212HanAvoid Jabba965585
04/02/20211LukeUse force550250
04/02/20211LukeLightsabre practice350150
04/02/20212HanShoot First265130
04/02/20212HanAvoid Jabba665390
05/02/20213ChewbaccaFix Falcon840320
05/02/20211LukeUse force850400
05/02/20212HanAvoid Jabba565325

I have seen on other posts on similar themes that I need an independent date table, which I have created. I have created relationships between the three tables against the date field, shown below:

 

When I visualise the data, it almost works - the actual hours are correct, but the forecast hours are not correct.

The total number of hours forecast for the time period is correct, but each line seems to replicate the forecast for the day. Also, I have tried to show how tasks that are not in the forecast are shown, e.g. Chewbacca - Fix the Falcon is not in the forecast table, but shows hours in the forecast column.

I hope I have explained my issue. I am new(ish) to PowerBI, so would be extremely grateful for any guidance or suggestions.

Kind regards

Neil

  • Hi,

    In the Dates Table there are blanks appearing in the Date column.  Remove those blanks rows.

9 Replies

  • Hi,

    1. The relationship between the Forecast/Actual Table and the Dates table should me Many to One with the cardinality set to Single
    2. Just as you have created a Dates table, create 2 additional tables Name and Activity - each table should only ontain unique entries with no blanks in each table.  Create a relationship from the Name/Activity columns of Forecast/Actual tables to the individual tables of Name and Activity
    3. To your visual drag Dates, Name and Activity from the Calendar and the 2 indiviaul tables that you created
    4. Now write your measures and drag them to your table.
  • NP2020's avatar
    NP2020
    Frequent Visitor

    Thank you Ashish_Mathur  for your reply.

     

    I have tried to create a Many to One relationship, but the system won't let me, saying "The cardinality you selected isn't valid for this relationship."

     

     

    Is there anything you can see that I am doing incorrect?

    Kind regards,

    Neil