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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Determine the number of business / workdays in the current month & previous month

I am trying to determine the number of business / workdays in the current month & the previous month.

I have a "Production" Fact Table on my dashboard with a period of 2 years.


I would also like to be able to do the following :

1) Determine the number of business / workdays in the current month & the previous month.

2) Allow the number of business / workdays in the current month & the previous month to change according to the selected "Production" date. (not compulsary)

3) Incorporate manual input of holidays possibly in sharepoint (yet to decide how) into the calculation of number of business / workdays in the current month & the previous month based on selected date.

 

What i have done so far :

1. Create a table :
Workday Calendar = CALENDAR(EOMONTH(TODAY(),-2)+1,EOMONTH(TODAY(),-2+2))
**note that this table do not have every single date in current month. (that's why i created a custom table)
2. Add Column to determine Day of the week :
Day = FORMAT('Workday Calendar'[Date],"dddd")
3. Add measure
Current Month Workdays = CALCULATE(COUNT('Workday Calendar'[Date]),'Workday Calendar'[Day] <> OR("Saturday","Sunday"),MONTH('Workday Calendar'[Date])=MONTH(TODAY()))
 
Why this did NOT work :
1) No relationship / connection with current model.

Final measures will be able to determine :
(1) to multiply "average daily current month estimate" * "number of current month working days" = current month production estimate
(2) "number of previous month working days"
1 ACCEPTED SOLUTION
littlemojopuppy
Community Champion
Community Champion

H @Anonymous 

With a date table that looks something like this (and make sure it is marked as a date table!)

littlemojopuppy_0-1609784349579.png

 

Create these measures

Workdays = 
    COUNTROWS(
        FILTER(
            'Calendar',
            AND(
                'Calendar'[Weekday] <> 1,
                'Calendar'[Weekday] <> 7
            )
        )
    )

Workdays PM = 
    CALCULATE(
        [Workdays],
        PREVIOUSMONTH('Calendar'[Date])
    )

 

littlemojopuppy_1-1609784418912.png

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , New column in date table

Work Day = if(WEEKDAY([Date],2)>=6,0,1)

 

as column

Work day of month = Sumx(filter(Date, [Month year] = earlier([Month year])),[Work Day])

 

Work day of previous month = Sumx(filter(Date, eomonth([Date],0) = eomonth(earlier([Date]),-1)  ),[Work Day])

 

Measure

MTD WorkDay= CALCULATE(SUM('Date'[Work Day]),DATESMTD('Date'[Date]))
last MTD WorkDay= CALCULATE(SUM('Date'[Work Day]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
littlemojopuppy
Community Champion
Community Champion

H @Anonymous 

With a date table that looks something like this (and make sure it is marked as a date table!)

littlemojopuppy_0-1609784349579.png

 

Create these measures

Workdays = 
    COUNTROWS(
        FILTER(
            'Calendar',
            AND(
                'Calendar'[Weekday] <> 1,
                'Calendar'[Weekday] <> 7
            )
        )
    )

Workdays PM = 
    CALCULATE(
        [Workdays],
        PREVIOUSMONTH('Calendar'[Date])
    )

 

littlemojopuppy_1-1609784418912.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.