Forum Discussion
Filter Non Working Days in a Date Range
Greetings Alll;
I have a working measure that calculates the number of (working) hours between 2 date ranges but I need to filter out the non working days in the calculation
The date range is in a table called Tempo Plans that shows the start date and end date of the Plan and the (working) hours per day
The measue is in that same table, using the TDates calendar table to count the days in the plan and sumX a total hours for the plan
Measure:
ok- actually solved my own problem and made a new column for the Plan Hours measure to reference - but if any one has a more sophisticated solution - please share - learning as I go here. Thx
I replaced the TDate[Date] column references in Plan Hours with TDate[WorkingDay] - new column calc I added in my TDates table
WorkingDay = IF(OR(TDate[WeekDay]=1,TDate[WeekDay]=7),date(1900,1,1),IF(ISBLANK(TDate[THoliday]),TDate[Date],date(1900,1,1)))
3 Replies
- Greg_Deckler
Community Champion
ctedesco3307 Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.- ctedesco3307
Resolver II
Hi Greg_Deckler Please find sample data and a screen shot of the calculation for the week 4/11 - 4/17. Please let me know what add'l info you need. Thanks
TEMPO_PLAN_ID DESCRIPTION ASSIGNEE_ID ASSIGNEE_TYPE CREATED UPDATED START_DATE END_DATE IS_INCLUDE_NON_WORKING_DAYS ITEM_ID ITEM_TYPE RECURRENCE_END_DATE RECURRENCE_RULE SECONDS_PER_DAY Hours Per Day RoleID 1014 5fe25438f7ea2a0107281d28 USER 8/9/2021 17:25 8/16/2021 18:31 4/11/2021 0:00 4/17/2021 0:00 FALSE UFF70UAR PROJECT 4/17/2021 0:00 NEVER 13680 3.8 UFF70UAR5fe25438f7ea2a0107281d28
- ctedesco3307
Resolver II
ok- actually solved my own problem and made a new column for the Plan Hours measure to reference - but if any one has a more sophisticated solution - please share - learning as I go here. Thx
I replaced the TDate[Date] column references in Plan Hours with TDate[WorkingDay] - new column calc I added in my TDates table
WorkingDay = IF(OR(TDate[WeekDay]=1,TDate[WeekDay]=7),date(1900,1,1),IF(ISBLANK(TDate[THoliday]),TDate[Date],date(1900,1,1)))