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
Anonymous
Not applicable

Need Help Writing DAX for "Count Business Days in the Weeks Selected in the Filter"

I need help with the formula for "Avg New" which are new tickets in the period. I do not know how to write the denominator formula. Right now, I hard coded it to say 35 (which is wrong anyway). 

 

Basically, I need the denominator to count the # of business days (Mon-Fri) in the weeks selected in the filter. 

 

FYI - For the weeks shown on the filter, I have those listed in the main *Smartsheet* table with a week end on Sat. I do have a date table but I do not know how to add a "week ending on Sat" column to my date table so not sure if I need that or not. Below is my date table query.

 

kendra_0-1668104827613.png

 

kendra_1-1668104922619.png

 

 

Date Email Received =

VAR __startDate = DATE ( 2022, 1, 1 )

VAR __endDate = DATE ( YEAR ( TODAY() ), 12, 31 )

VAR __dates = CALENDAR ( __startDate, __endDate )

RETURN

ADDCOLUMNS (

__dates,

"YYYY-MM-DD", FORMAT ( [Date], "YYYY-MM-DD" ),

"Year", YEAR ( [Date] ),

"Month Number", MONTH ( [Date] ),

"Month Full Name", FORMAT ( [Date], "MMMM" ),

"Month Short", FORMAT( [Date], "MMM"),

"Month, YYYY", FORMAT( [Date], "MMM, YYYY" ),

"Month YYYY-MM", FORMAT( [Date], "YYYY-MM" ),

"Week", FORMAT (WEEKNUM([Date], 1 ),"00"),

 
 

"YYYY-Week", concatenate(CONCATENATE(FORMAT ( [Date], "YYYY" ),"-"), FORMAT (WEEKNUM([Date], 1 ),"00")),

 

"Quarter", "Q" & FORMAT( [Date], "Q, YYYY" ),

"Quarter Sort", FORMAT ( [Date], "YYYY-Q" ) ,

"Day Name", FORMAT ( [Date], "DDD" ) ,

"Day Number", FORMAT ( [Date], "DD" ) ,

"Day Full Name", FORMAT ( [Date], "DDDD" )

)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

I added a "Business Day" column to my date table as follows:

kendra_0-1668451933080.png

 

Then I built a formula that sums the number of business days for the denominator

kendra_1-1668451978716.png

 

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Thanks for your help. I was able to find another way to do it. I just don't know enough about DAX and formulas but I found a way to rig up the calculation I need. 

Hi @Anonymous,

Did you mind sharing these here? I think they will be help for others who has a similar requirements.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

I added a "Business Day" column to my date table as follows:

kendra_0-1668451933080.png

 

Then I built a formula that sums the number of business days for the denominator

kendra_1-1668451978716.png

 

 

Greg_Deckler
Super User
Super User

@Anonymous Use NETWORKDAYS



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks @Greg_Deckler  but I am still not sure how to write the DAX code. This doesn't work

 

kendra_0-1668106490689.png

 

@Anonymous NETWORKDAYS is a function, / NETWORKDAYS( [start date], [end date]) for example.

NETWORKDAYS function (DAX) - DAX | Microsoft Learn

Are you on an old version of the Desktop?

If so, you can do it the old fashioned way: Net Work Days - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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! Prices go up Feb. 11th.

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.