Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Puja
Helper III
Helper III

Get 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

 

 

1 ACCEPTED SOLUTION
some_bih
Super User
Super User

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 Sunday
SELECTCOLUMNS (
    FILTER (
        CALENDAR ( TODAY(), TODAY() + 180 ),
        WEEKDAY ( [Date], 2 ) < 6
    ),
    "WeekdayDate", [Date]
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






View solution in original post

3 REPLIES 3
some_bih
Super User
Super User

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 Sunday
SELECTCOLUMNS (
    FILTER (
        CALENDAR ( TODAY(), TODAY() + 180 ),
        WEEKDAY ( [Date], 2 ) < 6
    ),
    "WeekdayDate", [Date]
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






some_bih
Super User
Super User

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 today
VAR _start_date = TODAY() // start date
VAR _end_date = _start_date + 180 // calculate 180 from today
VAR NumDays = _end_date - _start_date + 1
VAR _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 excluded
RETURN
    _Result

some_bih_0-1689077873240.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






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

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.