Forum Discussion
Adding only workdays to a specific date
- 8 years ago
Hi,
I created the calculations.
Try having a look at this: https://www.dropbox.com/s/5fareeag77bfc6x/power%20bi%20example.pbix?dl=0&m=
Result:
- 8 years ago
Okay - to assist others with similar challenges I will just make a short description of the solution I created.
First make sure that there is a relationship between the table and the calendar table.
Then in the calendar table create a few columns to create an index for workingdays
IsWorkday = SWITCH( WEEKDAY('Calendar'[Date]); 1; 0; 7; 0;1 ) WorkingDayIndex = RANKX( FILTER( 'Calendar'; 'Calendar'[IsWorkDay] = 1 ); 'Calendar'[Date]; ;ASC )Then in the table that should hold the result I created this calculation that make a simple lookup in the calendar table using the index column created above.
NewDate = VAR DateIdx = CALCULATE( MAX( 'Calendar'[WorkingDayIndex] ); 'Table1'[Date] = RELATED('Calendar'[Date] ) ) VAR NewDateIdx = DateIdx + Table1[Transport days] RETURN CALCULATE( MAX('Calendar'[Date]); FILTER( ALL('Calendar'); 'Calendar'[WorkingDayIndex] = NewDateIdx && 'Calendar'[IsWorkday] = 1 ) )
If you have the change, could you explane alittle more whet you mean?
I dont understand how to use that in this case
Anonymous,
Share us a simplified model please.
- Anonymous8 years agoNot applicable
Sure thing
A couple of dates as an example. We need to add these days to the date, but make sure that only the work days gets added, skip saturday and sunday
- Anonymous8 years agoNot applicable
As an example to further explane what i mean
the date 02.04.2017 with 16 days transport time would need the result to be 24.04.2017 when just counting work days.
and NOT 18.04.2017 (countet with weekends)
- sdjensen8 years agoSolution Sage
Try adding a working days index to your period table. If a day is not a working day then assign the same index number to this day as the previous day - then you should be able to calculate a column in your table where you find the index of your initial date add the transportation days to the index and return the lowest date with that index.