Greg_Deckler
8 years agoCommunity Champion
Net Work Days
Recreates the NETWORKDAYS function from Excel with some bonus measures and one that needs fixed or demonstrates a bug/documentation glitch.
NetWorkDays calculates the number of days between two...
Emanuel
5 years agoHelper I
Greg_Deckler I am trying to add x number of working days to the create date in order to get the review date. Any ideas how can I do that?
The specific requirement is:
for priority 1 add 5 working days, for P2 add 10 working days for P3&4 add 20 working days.
Thank you
Greg_Deckler
5 years agoCommunity Champion
Emanuel Hmm, maybe something like:
Measure =
VAR __AddDays =
SWITCH(MAX('Table'[Priority]),
"P1",5,
"P2",10,
20
)
VAR __CreatedDate = MAX('Table'[created date])
VAR __Calendar1 = CALENDAR(MAX(__CreatedDate+1,__CreatedDate+30)
VAR __Calendar2 = ADDCOLUMNS(__Calendar1,"WeekDay",WEEKDAY([Date],2))
VAR __Calendar3 = FILTER(__Calendar2,[WeekDay]<6),[Date])
VAR __Set = TOPN(__AddDays,__Calendar3,[Date],1)
RETURN
MAXX(__Set,[Date])- Anonymous4 years agoNot applicable
Hi Greg_Deckler , opening this thread. I have this same scenario, however, I need to exclude weekends. May I ask for your inputs/help on this? Thank you.
- Greg_Deckler4 years agoCommunity Champion
Anonymous Well, let's see, maybe something like:
Column = VAR __Date = [Query date received] VAR __IncludeWeekends = [Requirement] //assumes true/false VAR __Days = [Days to add] // assumes a numeric value VAR __Calendar = ADDCOLUMNS(CALENDAR(__Date, __Date + __Days * 2),"Weekday",WEEKDAY([Date],2)) VAR __CalendarX = ADDCOLUMNS( FILTER(__Calender,[Weekday] < 6), "Days", VAR __MyDate = [Date] RETURN COUNTROWS(FILTER(__Calendar,[Date] <= __MyDate) ) RETURN IF(__IncludeWeekends, __Date + __Days, MAXX(FILTER(__CalendarX,[Days] = __Days),[Date]))- Anonymous4 years agoNot applicable
Can I add switch function to filter per country? I have 9 countries, and all of them have different # of days to add.