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

How to find 4th working day of the month

Hi,

 

How to find 4th working day of the month in Power BI.

Note: Excluding Saturday and Sunday, not holidays.

 

Regards,

Pavan Vanguri.

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

@Anonymous 

Assuming you have a date table, you can add a column using the following formula. This will give the workday # of the month ignoring Saturday and Sunday. From there you can write measures that filter the DimDate table on this Workday Column

WorkDay = 
VAR __CurrentDate =  DimDate[Date]
VAR __CurrentMonth = MONTH( DimDate[Date] )
VAR __CurrentYear = Year( DimDate[Date])
VAR __Weekends = {6 ,0}
RETURN

IF (
    NOT DimDate[Day of Week] IN __Weekends,
        CALCULATE(
            COUNTROWS(
                FILTER(
                    ALL (DimDate),
                    __CurrentMonth = MONTH( DimDate[Date])
                    && __CurrentYear = YEAR (DimDate[Date])
                    && __CurrentDate >= DimDate[Date]
                    && NOT DimDate[Day of Week] IN __Weekends
                )
            )
        )
)

WorkDay Calc Column.png

View solution in original post

v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

In adddition ro Nick_M's solution,

If you want to excluding holidays as well,

Please create a holiday table with holiday date,

then connect it to your date table,

Create two columns in your date table

Day of Week = WEEKDAY([date],3)

related holiday = RELATED('holiday table'[date])

WorkDay = 
VAR __CurrentDate =  DimDate[Date]
VAR __CurrentMonth = MONTH( DimDate[Date] )
VAR __CurrentYear = Year( DimDate[Date])
VAR __Weekends = {6 ,0}
RETURN

IF (
    NOT DimDate[Day of Week] IN __Weekends,
        CALCULATE(
            COUNTROWS(
                FILTER(
                    ALL (DimDate),
                    __CurrentMonth = MONTH( DimDate[Date])
                    && __CurrentYear = YEAR (DimDate[Date])
                    && __CurrentDate >= DimDate[Date]
                    && NOT DimDate[Day of Week] IN __Weekends
                    && NOT DimDate[date]= [related holiday]
                )
            )
        )
)

7.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

In adddition ro Nick_M's solution,

If you want to excluding holidays as well,

Please create a holiday table with holiday date,

then connect it to your date table,

Create two columns in your date table

Day of Week = WEEKDAY([date],3)

related holiday = RELATED('holiday table'[date])

WorkDay = 
VAR __CurrentDate =  DimDate[Date]
VAR __CurrentMonth = MONTH( DimDate[Date] )
VAR __CurrentYear = Year( DimDate[Date])
VAR __Weekends = {6 ,0}
RETURN

IF (
    NOT DimDate[Day of Week] IN __Weekends,
        CALCULATE(
            COUNTROWS(
                FILTER(
                    ALL (DimDate),
                    __CurrentMonth = MONTH( DimDate[Date])
                    && __CurrentYear = YEAR (DimDate[Date])
                    && __CurrentDate >= DimDate[Date]
                    && NOT DimDate[Day of Week] IN __Weekends
                    && NOT DimDate[date]= [related holiday]
                )
            )
        )
)

7.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@Anonymous 

Assuming you have a date table, you can add a column using the following formula. This will give the workday # of the month ignoring Saturday and Sunday. From there you can write measures that filter the DimDate table on this Workday Column

WorkDay = 
VAR __CurrentDate =  DimDate[Date]
VAR __CurrentMonth = MONTH( DimDate[Date] )
VAR __CurrentYear = Year( DimDate[Date])
VAR __Weekends = {6 ,0}
RETURN

IF (
    NOT DimDate[Day of Week] IN __Weekends,
        CALCULATE(
            COUNTROWS(
                FILTER(
                    ALL (DimDate),
                    __CurrentMonth = MONTH( DimDate[Date])
                    && __CurrentYear = YEAR (DimDate[Date])
                    && __CurrentDate >= DimDate[Date]
                    && NOT DimDate[Day of Week] IN __Weekends
                )
            )
        )
)

WorkDay Calc Column.png

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.