Forum Discussion
Puja
Helper III
3 years agoGet only weekdays (exclude weekends) in measure
Hello all,
Is there a way to get only weekdays (exclude weekends) for the next 6 months based on today's date in measure
Ex:Today() + 180 days and exclude weekends.
TIA
Hi Puja Below is code for creation of calculated tables with dates.
Did I answer your question? Mark my post as a solution! Kudos Appreciated!
Weekdays_Table =//create calculated table with weekdays 180 from today//WEEKDAY function with values 2 means days Numbers 1 (Monday) through 7 (Sunday), so 6 and 7 are Saturday and SundaySELECTCOLUMNS (FILTER (CALENDAR ( TODAY(), TODAY() + 180 ),WEEKDAY ( [Date], 2 ) < 6),"WeekdayDate", [Date])
3 Replies
- some_bih
Community Champion
Hi Puja for measure one of approach is as shown below:
Did I answer your question? Mark my post as a solution! Kudos Appreciated!
#WeekdaysNextSixMonths =//calculation of weekdays 180 from todayVAR _start_date = TODAY() // start dateVAR _end_date = _start_date + 180 // calculate 180 from todayVAR NumDays = _end_date - _start_date + 1VAR _Result =SUMX(GENERATESERIES(_start_date, _end_date, 1),IF(WEEKDAY([Value]) <> 1 && WEEKDAY([Value]) <> 7,1,0))//WEEKDAY with values 1 and 7 means Saturday and Sunday is excludedRETURN_Result- Puja
Helper III
Hi some_bih ,
Thank you . I need to get DATES and not number (129). Sorry I was not clear in my request.
Like below exclude weekends.
7/11/2023 7/11/2023 7/11/2023 7/11/2023 7/11/2023 7/11/2023 7/12/2023 7/12/2023 7/12/2023 7/12/2023 7/12/2023 7/12/2023 7/13/2023 7/13/2023 7/13/2023 7/13/2023 7/13/2023 7/13/2023 7/14/2023 7/14/2023 7/14/2023 7/14/2023 7/14/2023 7/14/2023 7/17/2023 7/17/2023 7/17/2023 7/17/2023 7/17/2023 7/17/2023 7/18/2023 7/18/2023 7/18/2023 7/18/2023 7/18/2023 7/18/2023 7/19/2023 7/19/2023 7/19/2023 7/19/2023 7/19/2023
- some_bih
Community Champion
Hi Puja Below is code for creation of calculated tables with dates.
Did I answer your question? Mark my post as a solution! Kudos Appreciated!
Weekdays_Table =//create calculated table with weekdays 180 from today//WEEKDAY function with values 2 means days Numbers 1 (Monday) through 7 (Sunday), so 6 and 7 are Saturday and SundaySELECTCOLUMNS (FILTER (CALENDAR ( TODAY(), TODAY() + 180 ),WEEKDAY ( [Date], 2 ) < 6),"WeekdayDate", [Date])