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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
nandukrishnavs
Community Champion
Community Champion

@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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors