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

Working minutes in POWER BI without holidays and no weekends.

Working minutes in POWER BI without holidays and no weekends. for the program from 09:00 to 17:00

I have two columns:
start_date and stop_date

 

NRSTARTSTOP
12905677020/12/2018 11:5320/12/2018 11:53
12905677121/12/2018 11:0121/12/2018 11:12
12905677227/12/2018 13:5527/12/2018 13:55
12905677311/12/2018 14:3411/12/2018 14:34
12905677414/12/2018 16:3814/12/2018 16:42
1 ACCEPTED SOLUTION

Hi @Xcris22 ,

I create a sample based on your data model. You could reference it to modify your report.

  • Create a new column to relate to holidays table.

 

Day = 'Table'[START].[Date]

 

  • Create a holidays table and create a one-one relationship between the tables.  (I get it from web.) 

1.PNG

  • Create columns in "Table"

 

WeekDay = WEEKDAY('Table'[START],2)

Holiday = RELATED(Holidays[Day])

If work day = IF(OR('Table'[WeekDay]=6,'Table'[WeekDay]=7),0,IF(ISBLANK('Table'[Holiday]),1,0))

 

  • Create a measure

 

Working minutes = CALCULATE(DATEDIFF(MAX('Table'[START]),MAX('Table'[STOP]),MINUTE),FILTER('Table','Table'[If work day]=1))

 

3.PNG

 

Edit :

If there is data that the start date and stop date are not same day in your table, you could reference the thread to have a try.

 

Best Regards,

Xue Ding

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

Best Regards,
Xue Ding
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

5 REPLIES 5
parry2k
Super User
Super User

@Xcris22 Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Please share data in excel using onedrive/google drive to get your answer quickly. Remove any sensitive information before sharing.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Done, thx for sugestion

Hi @Xcris22 ,

Based on your sample data, I created a calculated column using DATEDIFF function to implement it. 

Working minutes = DATEDIFF('Table'[START],'Table'[STOP],MINUTE) 

5.PNG 

If you need a measure, please try the formula below :

Measure = DATEDIFF(MAX('Table'[START]),MAX('Table'[STOP]),MINUTE)

 

Best Regards,

Xue Ding

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

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

@v-xuding-msft 

need to exclude our Romanian holidays. and the programs  for work is  09:00 am-17:00 pm 

Hi @Xcris22 ,

I create a sample based on your data model. You could reference it to modify your report.

  • Create a new column to relate to holidays table.

 

Day = 'Table'[START].[Date]

 

  • Create a holidays table and create a one-one relationship between the tables.  (I get it from web.) 

1.PNG

  • Create columns in "Table"

 

WeekDay = WEEKDAY('Table'[START],2)

Holiday = RELATED(Holidays[Day])

If work day = IF(OR('Table'[WeekDay]=6,'Table'[WeekDay]=7),0,IF(ISBLANK('Table'[Holiday]),1,0))

 

  • Create a measure

 

Working minutes = CALCULATE(DATEDIFF(MAX('Table'[START]),MAX('Table'[STOP]),MINUTE),FILTER('Table','Table'[If work day]=1))

 

3.PNG

 

Edit :

If there is data that the start date and stop date are not same day in your table, you could reference the thread to have a try.

 

Best Regards,

Xue Ding

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

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

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.