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
tuliosouzaa
Frequent Visitor

Calculate total hours worked in own and others projects from ''weirdly'' structured data

I have a table like this:

 

Assigned ToWorked ByWorked Hours
JoshJosh25
JoshMaria26
PhillipPhillip48
PhillipMaria52
PhillipJulia64
MariaMaria98
MariaJosh70
MariaPhillip52
MariaAndre30
MariaJulia60
JuliaJulia84
JuliaMaria50
JuliaPhillip22
AndreAndre12
AndreJosh36
AndrePhillip47
AndreJulia22

 

And I need to create a visual where I display the support given by a worker (hours worked in others projects) and the support received (hours others worked in their projects).

 

Considering this dummy data I would have a visual such as:

tuliosouzaa_2-1709667277577.png

 

I tried all kinds of formulas but I could only get to the point where I get the support received. 

 

If possible (or needed) the result could also be a table such as:

WorkerWorked HoursSupport ReceivedSupport Given
Josh13138106
Phillip181116133
Maria226212128
Julia23072146
Andre4210530


Is it possible to achieve this with the data I'm starting from?

2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

@tuliosouzaa 

not sure if the expected of support receive is correct. It's becasue what I get is different from yours

1. try to create a table

Table 2 = DISTINCT('Table'[Assigned To])
don't create relationship
2. create measures
workedhours = sumx(FILTER('Table','Table'[Worked By]=max('Table 2'[Assigned To])),'Table'[Worked Hours])
supported receive = sumx(FILTER('Table','Table'[Assigned To]=max('Table 2'[Assigned To])&&'Table'[Worked By]<>max('Table 2'[Assigned To])),'Table'[Worked Hours])
support given = sumx(FILTER('Table','Table'[Worked By]=max('Table 2'[Assigned To])&&'Table'[Assigned To]<>max('Table 2'[Assigned To])),'Table'[Worked Hours])
11.PNG
pls see the attachment below
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

v-kaiyue-msft
Community Support
Community Support

Hi @tuliosouzaa  ,

 

@ryan_mayu  provided very correct solution, I'll add how to get the desired visual.
1. Create a metric to get the percentage of support provided.

given % = 'Table'[support given] / 'Table'[workedhours]

2. Create a metric to get the percentage of support received.

received % = 'Table'[supported receive] / 'Table'[workedhours]

3. Create the visual object, put the fields and the final result as shown in the figure below.

vkaiyuemsft_0-1709710157421.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-kaiyue-msft
Community Support
Community Support

Hi @tuliosouzaa  ,

 

@ryan_mayu  provided very correct solution, I'll add how to get the desired visual.
1. Create a metric to get the percentage of support provided.

given % = 'Table'[support given] / 'Table'[workedhours]

2. Create a metric to get the percentage of support received.

received % = 'Table'[supported receive] / 'Table'[workedhours]

3. Create the visual object, put the fields and the final result as shown in the figure below.

vkaiyuemsft_0-1709710157421.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ryan_mayu
Super User
Super User

@tuliosouzaa 

not sure if the expected of support receive is correct. It's becasue what I get is different from yours

1. try to create a table

Table 2 = DISTINCT('Table'[Assigned To])
don't create relationship
2. create measures
workedhours = sumx(FILTER('Table','Table'[Worked By]=max('Table 2'[Assigned To])),'Table'[Worked Hours])
supported receive = sumx(FILTER('Table','Table'[Assigned To]=max('Table 2'[Assigned To])&&'Table'[Worked By]<>max('Table 2'[Assigned To])),'Table'[Worked Hours])
support given = sumx(FILTER('Table','Table'[Worked By]=max('Table 2'[Assigned To])&&'Table'[Assigned To]<>max('Table 2'[Assigned To])),'Table'[Worked Hours])
11.PNG
pls see the attachment below
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Bipin-Lala
Responsive Resident
Responsive Resident

Hi @tuliosouzaa,

 

I hope if you have understood your question correctly, you can do a couple of transformations in the query editor to achieve the final table expected by you.

The end result looks something like this - 

BipinLala_0-1709670269280.png

I was able to achieve this by creating 2 reference tables from the "weirdly structured" input table, one table for Assigned hours and one for Worked Hours. Later I merged back these 2 tables on the person name, to bring the data together and visualize it in the report. I am attaching the link to the pbix file for you to review the steps.

Hours_Worked pbix

 

Do let me know how it goes!

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.