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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Help with creating an hours total chart?

I have an imported table that contains employee names (memberID) their scheduled hours (Hours) and the date that the hours are scheduled (Date). I also have a Date Table created for "date" relationships. (To break dates into months, weeks, etc etc).

 

I'm trying to build a chart similar to the screenshot below - that shows each employees sum or hours per week.

 

1) I'm not sure what chart to pick (if this is even possible)?

2) I have another table (Relationships) that categorizes those hours into several different types (ie "Revenue", "Non-Revenue", "Other"). So I'd like to be able to click on any employee's box (Ie John Doe's '34.75') it will break that 34.75 into the categories (second screen shot)

 

Any help would be much appreciated.

 

HIGH LEVEL TABLE I'D LIKE TO REPLICATE (NOTE: COLORING IS JUST BASED ON UTILIZATION. IE >40 HOURS THAT WEEK = BLUE, >30 HOURS, GREEN, ETC ETC)

screenshotMod.jpg

DRILL DOWN CHART OF JOHN DOE WEEK 03/14 HOURS:

chart2.jpg

 

MY DATA:

 

hoursPBIReport.jpg

5 REPLIES 5
rsbin
Super User
Super User

@Anonymous ,

The Visual I use for this is the Matrix Visual.

Drag Employee Name into the Rows, and  Week from your Date Table into Columns.  I use Date in my example below.

Bring Scheduled Hours into the values:  (I have additional rows that you do not need)

 

rsbin_0-1662048238427.png

rsbin_1-1662048402732.png

This is the first step to get working.  Once you get this, then you can move on to conditional formatting.

Hope this gets you going in the right direction

 

Anonymous
Not applicable

Thank you SO much, this helps me quite a bit. If I may, follow-up question - how do you get your week column headers? My date table is defined as below with the available fields in the screen shot to the right.

THANK YOU!

TableDT = 
VAR MinYear = YEAR ( MIN ('CW_Scheduled Hours'[Date] ) )
VAR MaxYear = YEAR ( MAX ('CW_Scheduled Hours'[Date] ) )
RETURN
ADDCOLUMNS (
FILTER (
CALENDARAUTO( ),
AND ( YEAR ( [Date] ) >= MinYear, YEAR ( [Date] ) <= MaxYear )
),
"Calendar Year", "CY " & YEAR ( [Date] ),
"Month Name", FORMAT ( [Date], "mmmm" ),
"Month Number", MONTH ( [Date] ),
"Week Number", WEEKNUM ( [Date] ),
"Year Number", YEAR ( [Date] ),
"Index", 12 * YEAR ( [Date] ) + MONTH ( [Date] ))

 tables.jpg

@Anonymous ,

Create another calculated column and concatenate "Year Number" and "Week Number"

Year-WeekNumber = SWITCH(
                            TRUE(),
                            [Week Number] < 10, [Year Number]  & "-0" & [Week Number],
	                    [Week Number] >= 10, [Year Number]  & "-" & [Week Number] )

I use this to ensure all digits line up correctly.

Glad you are going in the right direction.

Regards,

Anonymous
Not applicable

I am very sorry to keep asking questions. Two follow-ups if you don't mind:
1) How does the "TRUE()" fit into the Switch? Why is it there?

2) How would I limit the # of weeks to the following 4 weeks only (4 weeks after the currennt week). Would this be in the filter somehow?

Thank you, again!

Rob

@Anonymous ,

Good Morning.

1)  Don't have a good answer for you.  Whoever taught me this function, did it this way and has been working for me ever since.   Maybe a youtube video may have a better explanation.

2)  I think using the Filter Pane would be your best bet.  On your Visual Level filter, drag in your Date column and use the Relative Date filter.  Select "is in the next" and then fill in 28 days or whatever you need it to be.

Glad I could help and good luck.

Regards,

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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