Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
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?
Solved! Go to Solution.
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.
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.
@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
@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
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.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
124 | |
79 | |
50 | |
38 | |
38 |
User | Count |
---|---|
196 | |
80 | |
70 | |
51 | |
42 |