Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
NP2020
Frequent Visitor

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:

power_bi_relationships.png

 

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

powerbi_table_output.pngThe 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

1 ACCEPTED SOLUTION

Hi,

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


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

9 REPLIES 9
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."

 

powerbi_relationships_table_2.png

 

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

Kind regards,

Neil

Hi,

I'll need to see your PB file.  Share the download link.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

Ensure that your staff number in both the Actual and Forecast table match with the staff number in the staff table.  Click on Refresh All.

Download the PBI file from here.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks @Ashish_Mathur , I have been able to download and review the PBI. I can see what you have done, but am unable to replicate the same relationships in my own PBI file.

Is there a specific method for creating this type of relationship?

Also, when I select Many to One, the Cross Filter Direction drop down has two versions for Single - Dates filters forecast and Forecast filters Dates. Does this make a difference?

powerbi_relationships_table_3.png

Kind regards,

Neil

Hi,

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


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur , that's great, thank you for all of your help.

 

Kind regards,

Neil

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

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.

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.