cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mikito
New Member

Count hours by employee over multiple columns

Brand new to Power BI and I have a simple problem I haven't yet been able to solve. 

 

I want to chart the sum of hours by each employee from the data below:

 

Hours  Employee1  Employee2  Employee3  
3.0BillJack[null]
0.5Jack[null][null]
5.0SamJackBill

 

Chart/graph would display:

Bill, 8.0

Jack, 8.5

Sam, 5.0

 

Thanks!

 

1 ACCEPTED SOLUTION
mahoneypat
Super User IV
Super User IV

To do this, you should unpivot the data.  In the query editor, select your Hours column, right click, and choose "Unpivot Other Columns.  Delete the column with Employee1, Employee2, ... and Rename the column with Names to "Employee".  Load that table and make a table visual with the Emplyee and Hours columns.  Set the aggregation of the Hours column to Sum.

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

1 REPLY 1
mahoneypat
Super User IV
Super User IV

To do this, you should unpivot the data.  In the query editor, select your Hours column, right click, and choose "Unpivot Other Columns.  Delete the column with Employee1, Employee2, ... and Rename the column with Names to "Employee".  Load that table and make a table visual with the Emplyee and Hours columns.  Set the aggregation of the Hours column to Sum.

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors