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
lherbert501
Post Partisan
Post Partisan

Next Working Day

Hi,

 

I have a query that gives me the 1st day of the previous month and it works grerat.

 

1stDayPrevMonth =
VAR __prevMonthDay = EOMONTH(MAX(RS_Dates[DateFull]),-1)+1
RETURN
CALCULATE(
        [Total Sales],  
      Sales_Snapshot[Date Added] = __prevMonthDay
)
 
Trouble is the 01/10/22 and 02/10/22 was a weekend. How would I add to my query to move onto the next working day?
I have working day flags set up etc already,
 
Thanks
 
Liam 
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You could use

1st Working Day Prev Month =
VAR __prevMonthDay =
    EOMONTH ( MAX ( RS_Dates[DateFull] ), -1 ) + 1
VAR __PrevMonthWorkingDay =
    CALCULATE (
        MIN ( RS_Dates[DateFull] ),
        REMOVEFILTERS ( RS_Dates[DateFull] ),
        RS_Dates[DateFull] >= __prevMonthDay,
        RS_Dates[Is Working Day] = TRUE ()
    )
RETURN
    CALCULATE ( [Total Sales], Sales_Snapshot[Date Added] = __PrevMonthWorkingDay )

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

You could use

1st Working Day Prev Month =
VAR __prevMonthDay =
    EOMONTH ( MAX ( RS_Dates[DateFull] ), -1 ) + 1
VAR __PrevMonthWorkingDay =
    CALCULATE (
        MIN ( RS_Dates[DateFull] ),
        REMOVEFILTERS ( RS_Dates[DateFull] ),
        RS_Dates[DateFull] >= __prevMonthDay,
        RS_Dates[Is Working Day] = TRUE ()
    )
RETURN
    CALCULATE ( [Total Sales], Sales_Snapshot[Date Added] = __PrevMonthWorkingDay )

Thankyou @johnt75, really appreciate it 🙂

 

Works great

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.