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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nbarta
Frequent Visitor

Can I create a new table based on a measure?

I have a data set with person number, week number, and hours worked for that day. I'm trying to calculate the average number of hours per week each employee worked, and then be able to group the COUNT of personIDs with the same number of average number of hours worked. Essentially answering the question, how many employees worked an average of 8 hours per week.

 

I was able to calculate the average number of hours per week per employee, but when I tried to map it to a table with count of person ID it did not work at all. 

 

My calculation for average hours per weeks looks like this... 

AvgHrPerWeek = ROUND(AVERAGEX(
KEEPFILTERS(VALUES('Table'[WeekNumber])),
CALCULATE(SUM('Table'[HoursWorked]))),0)
 
When placed in a table with PersonID this works great as it calculates each average hours per PersonID. The next step is the tricky one where I want to essentially take that PersonID and calculated measure of Average Hours and then calculate how many PersonIDs have the same AverageHours and map that on a graph with AverageHours on the horizontal axis and PersonID on the vertical. 

 

PersonIDWeekNumberHoursWorked
002318
002316
002349
002344
002362
002366
002366
002363
002518
002516
002544
002742
002745
002927
002928
002962

 

1 REPLY 1
Anonymous
Not applicable

Hi, unfortunately a measure can't be used in the same way as a column. In this case I suggest that you create a new calculated table with the average hours by PersonID. You can do that by wrapping your own measure in a SUMMARIZE like this:

 

PerPerson = SUMMARIZE('Table', 'Table'[PersonID]; "AverageHours"; ROUND(AVERAGEX(
KEEPFILTERS(VALUES('Table'[WeekNumber])),
CALCULATE(SUM('Table'[HoursWorked]))),0))
 
From that table it should be easy to create the visual you want.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors