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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Karthik12
Post Patron
Post Patron

no of worked days and remaining working days between choosen days

Team,

I would like to calculate no of worked days between 26th Nov 2022 till yesterday and

remaining working days from today to 31st december (Exclude Sundays and specified holidays)

 

Can someone please help?

 

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but I suggest having a calendar table with holiday indicating column like below.

I tried to create a sample pbix file like below.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_0-1670225746389.png

 

 

No of workdays from 26Nov until yesterday: =
VAR _startdate =
    DATE ( 2022, 11, 26 )
VAR _yesterday =
    TODAY () - 1
VAR _exceptholidayandsunday =
    FILTER (
        'Calendar',
        'Calendar'[Holiday] <> 1
            && 'Calendar'[Day Name] <> "Sunday"
            && 'Calendar'[Date] >= _startdate
            && 'Calendar'[Date] <= _yesterday
    )
RETURN
    COUNTROWS ( _exceptholidayandsunday )

 

No of workdays from today until 31Dec: = 
VAR _startdate =
    TODAY()
VAR _enddate =
    DATE(2022,12,31)
VAR _exceptholidayandsunday =
    FILTER (
        'Calendar',
        'Calendar'[Holiday] <> 1
            && 'Calendar'[Day Name] <> "Sunday"
            && 'Calendar'[Date] >= _startdate
            && 'Calendar'[Date] <= _enddate
    )
RETURN
    COUNTROWS ( _exceptholidayandsunday )

 

 

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

@Karthik12 sorry I forgot to remove -1

 

No of days till 31 st Dec = var _D = DATE(2022,12,31)
 return
     NETWORKDAYS(TODAY(),_D,11)

For holiday and other detail please go through doc: https://learn.microsoft.com/en-us/dax/networkdays-dax

View solution in original post

5 REPLIES 5
Karthik12
Post Patron
Post Patron

@ddpl @Jihwan_Kim thank you both. It works fine for me.

ddpl
Solution Sage
Solution Sage

@Karthik12 try this

Working days till Yesterday = var _D = DATE(2022,11,26)
return
NETWORKDAYS(_D,TODAY()-1,11)
No of days till 31 st Dec = var _D = DATE(2022,12,31)
 return
     NETWORKDAYS(TODAY()-1,_D,11)

For holiday and other detail please go through doc: https://learn.microsoft.com/en-us/dax/networkdays-dax

@ddpl Thanks for the input. It works fine for working days till yesterday. But, remaining days was increased one day while compared to yesterday.

Actually It should be reduced one day.

Can you please check?

@Karthik12 sorry I forgot to remove -1

 

No of days till 31 st Dec = var _D = DATE(2022,12,31)
 return
     NETWORKDAYS(TODAY(),_D,11)

For holiday and other detail please go through doc: https://learn.microsoft.com/en-us/dax/networkdays-dax
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but I suggest having a calendar table with holiday indicating column like below.

I tried to create a sample pbix file like below.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_0-1670225746389.png

 

 

No of workdays from 26Nov until yesterday: =
VAR _startdate =
    DATE ( 2022, 11, 26 )
VAR _yesterday =
    TODAY () - 1
VAR _exceptholidayandsunday =
    FILTER (
        'Calendar',
        'Calendar'[Holiday] <> 1
            && 'Calendar'[Day Name] <> "Sunday"
            && 'Calendar'[Date] >= _startdate
            && 'Calendar'[Date] <= _yesterday
    )
RETURN
    COUNTROWS ( _exceptholidayandsunday )

 

No of workdays from today until 31Dec: = 
VAR _startdate =
    TODAY()
VAR _enddate =
    DATE(2022,12,31)
VAR _exceptholidayandsunday =
    FILTER (
        'Calendar',
        'Calendar'[Holiday] <> 1
            && 'Calendar'[Day Name] <> "Sunday"
            && 'Calendar'[Date] >= _startdate
            && 'Calendar'[Date] <= _enddate
    )
RETURN
    COUNTROWS ( _exceptholidayandsunday )

 

 

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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