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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Tuckie
Frequent Visitor

Percentage of Business Days passed for the month

I currently have a Date table populated with:

 

* FullDate (date)

* MonthBeginDate (date)

* MonthEndDate (date)

* IsBusinessDay (String "Y" or "N")

 

I am trying to add 3 columns in DAX (or in the query builder, but I doubt that is possible):

 

* BusinessDaysForMonth

* BusinessDaysPassedForMonth

* PercentBusinessDaysPassedForMonth

 

any help would be much appreciated

1 ACCEPTED SOLUTION

Hey,

 

thanks for taking the time to prepare the pbix file. I'm not able to recreate the calculated columns I posted in my initial answer - this is so weird.

 

Nevertheless - here you will find a working solution where the DAX statement of the calculated columns is slightly adjusted:

 

Business Days passed = 
var currentDate = 'Calendar'[Date]
var firstdayofmonth = EOMONTH(currentDate, -1)+1
var daterange = DATESBETWEEN('Calendar'[Date], firstdayofmonth, currentDate)
return
//countrows(daterange)
CALCULATE(
    SUM('Calendar'[Is Business Day])
    ,All('Calendar')
    ,daterange
)

and

Business Days per Month = 
var currentDate = 'Calendar'[Date]
var firstdayofmonth = EOMONTH(currentDate, -1)+1
var lastdayofmonth = EOMONTH(currentDate, 0)
var daterange = DATESBETWEEN('Calendar'[Date], firstdayofmonth, lastdayofmonth)
return
CALCULATE(
    SUM('Calendar'[Is Business Day])
	,All('Calendar')
    ,daterange
)

Thanks for your patience and pointing me to an issue in my solution

 

Regards



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

11 REPLIES 11

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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