cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Calculating number of days worked?

I have my data in the following format:

Screenshot_2.png

 

I need my visual in the following format. I already have measures defined for total hours worked per day, I'm just having a bit of trouble with the number of days worked.

Screenshot_3.png

 

Thanks a lot.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Calculating number of days worked?

hi  @amalm 

If so, create two measure as below:

Fulldays = 
var _table= SUMMARIZE('Table','Table'[username],'Table'[date],"hours",CALCULATE(SUMX('Table',DATEDIFF('Table'[start time],'Table'[end time],MINUTE)))/60)
 return
COUNTAX(FILTER(_table,[hours]>=6),[date])
Halfdays = 
var _table= SUMMARIZE('Table','Table'[username],'Table'[date],"hours",CALCULATE(SUMX('Table',DATEDIFF('Table'[start time],'Table'[end time],MINUTE)))/60)
 return
COUNTAX(FILTER(_table,[hours]<6),[date])

 

Regards,

Lin

Community Support Team _ Lin
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

6 REPLIES 6
Highlighted
Super User II
Super User II

Re: Calculating number of days worked?

Hi @amalm 

smth like

days worked measure = 
CALCULATE(SUMX(Table, ([end time] - [start time])/24) )

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Highlighted
Community Champion
Community Champion

Re: Calculating number of days worked?

@amalm 

 

If there is no additional logic for considering a date as a working day, you can calculate the distinct count of the date column.

Example

 

Usernamedate
user112 April 2020
user112 April 2020
user212 April 2020
user212 April 2020
user312 April 2020
user113 April 2020

 

Measure = DISTINCTCOUNT(MyTable[date])

Capture.JPG

 

Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂

Highlighted
Super User IV
Super User IV

Re: Calculating number of days worked?

@amalm , what is role of time for this.

 

You can use a measure  distinctcount(Table[Date])



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Highlighted
Community Support
Community Support

Re: Calculating number of days worked?

hi  @amalm 

If there is a working time limit to determine if it's a worked day?

If not, Just create a measure as below:

Measure = DISTINCTCOUNT(Table[Date])

if yes, please share the logic of it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper II
Helper II

Re: Calculating number of days worked?

Thank you, what if I want to have 2 measures Fulldays and Halfdays where anything less than total 6 hours is considered a half day?

Highlighted
Community Support
Community Support

Re: Calculating number of days worked?

hi  @amalm 

If so, create two measure as below:

Fulldays = 
var _table= SUMMARIZE('Table','Table'[username],'Table'[date],"hours",CALCULATE(SUMX('Table',DATEDIFF('Table'[start time],'Table'[end time],MINUTE)))/60)
 return
COUNTAX(FILTER(_table,[hours]>=6),[date])
Halfdays = 
var _table= SUMMARIZE('Table','Table'[username],'Table'[date],"hours",CALCULATE(SUMX('Table',DATEDIFF('Table'[start time],'Table'[end time],MINUTE)))/60)
 return
COUNTAX(FILTER(_table,[hours]<6),[date])

 

Regards,

Lin

Community Support Team _ Lin
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

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors