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
amalm
Helper III
Helper III

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

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
v-lili6-msft
Community Support
Community Support

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.

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?

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.
amitchandak
Super User
Super User

@amalm , what is role of time for this.

 

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

nandukrishnavs
Super User
Super User

@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
🙂


Regards,
Nandu Krishna

az38
Community Champion
Community Champion

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

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.