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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Measure to overtime work

Hi everyone!

 

I have a database where each row is a time entry on a given day. I can have more than one entry for the same day per user.

 

ResourceDateHours
Maria09/02/20208.0
Maria10/02/20205.0
Maria10/02/20205.0
Marcos09/02/202010.0
Marcos10/02/20206.0
Marcos10/02/20206.0

 

With that, I created a matrix that shows the sum of hours worked per day by resource.

 

Resource09/02/202010/02/2020
Maria8.010.0
Marcos10.012.0

 

I would like to show on a card how many hours each resource worked beyond 8h per day.

 

In the example, I would like to get the number 8.0 (2.0 hours from Maria and 6.0 from Marcos).

 

Any ideas on how I would do this?

 

Best regards

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

Hello @Ashish_Mathur , thanks for your help. Worked like a charm.

 

But can you explain the concept behind the "ABCD"?

 

Tnks @MartynRamsden , but your measure didn't work 😞

I need to study how to use variables in Power BI.

 

Also tnks @amitchandak

I understood your thinking. The measure worked in a table, but the sum was wrong :S

 

 

Hi,

You are welcome.  The SUMMARIZE function creates a virtual table.  the third input in that function is the title of the new column that you want to give to the second column of that virtual table.

If my previous reply helped, please mark it as Answer.


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

Exactly, I looked at the SUMMARIZE syntax later and saw that there is something beyond <groupBy_columnName>. 

 

I didn't notice that part of the syntax: <name>, <expression>.

 

Thanks for your help, I will consider your answer as the solution.

You are welcome.


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

Please find the solutions at

https://www.dropbox.com/s/9i3e2wvpl3310bb/extrahours.pbix?dl=0

Work Hours = DISTINCTCOUNT(overtime[Date])*8 
Diff = SUM(overtime[Hours])-[Work Hours]

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

 

MartynRamsden
Solution Sage
Solution Sage

Hi @Anonymous 

 

Try this measure:

Over 8hrs = 
VAR HoursWorked = SUM ( Table1[Hours] )
VAR Result = HoursWorked - 8
RETURN Result

 

Best regards,

Martyn

 

If I answered your question, please help others by accepting it as a solution.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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