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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
A_H
Frequent Visitor

Calculate the current business day number in the month

Dears,

 

 

I am new to Power BI, I have the dim date table inculde a column called "Working dayes" and the value is 1 or 0, the 1 is for working day and 0 for weekend.

I want to know the cuurent buiness day number for each day .

please check the bleow example:



 

DayWorking Day
I want to calculate this caloumn 
Working day number 
Thursday, November 1, 201811
Friday, November 2, 20180 
Saturday, November 3, 201812
Sunday, November 4, 201813
Monday, November 5, 201814
Tuesday, November 6, 201815
Wednesday, November 7, 201816
1 ACCEPTED SOLUTION
LivioLanzo
Solution Sage
Solution Sage

Hi @A_H

 

you need to create a month and year columns and then you can do:

 

=
IF (
    'Table'[Working Day] = 0,
    BLANK (),
    CALCULATE (
        SUM ( 'Table'[Working Day] ),
        ALLEXCEPT ( 'Table', 'Table'[Month], 'Table'[Year] ),
        'Table'[Day] <= EARLIER ( 'Table'[Day] )
    )
)

 

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

View solution in original post

7 REPLIES 7
LivioLanzo
Solution Sage
Solution Sage

Hi @A_H

 

you need to create a month and year columns and then you can do:

 

=
IF (
    'Table'[Working Day] = 0,
    BLANK (),
    CALCULATE (
        SUM ( 'Table'[Working Day] ),
        ALLEXCEPT ( 'Table', 'Table'[Month], 'Table'[Year] ),
        'Table'[Day] <= EARLIER ( 'Table'[Day] )
    )
)

 

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Thank you so much for this solution! I have been searching for over 9 hours. 

Thanks 

PattemManohar
Community Champion
Community Champion

@A_H Please confirm that you want to flag working days i.e (Mon - Fri) and Sat - Sun are weekends. So you want to flag working days as 1 and weekends as 0.





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




all dayes are working days except friday and the woking days coulmn is calculated what I need I want to know the current working day number in the current month.

@A_H Please try this as a "New Column"

 

WorkingDayNumber = 
VAR _Rnk = RANKX(FILTER(Test80WorkinDay,FORMAT([Date],"DDDD")<>"Friday" && FORMAT([Date],"MMYYYY") = FORMAT(EARLIER([Date]),"MMYYYY") ),[Date],[Date],ASC) 
RETURN IF(FORMAT([Date],"DDDD")="Friday",0,_Rnk)

Please Note - I've flagged all Fridays as 0 (As it is a non-working day)

 

image.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Thnaks pattemmanohar 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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