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
NGC48
Helper I
Helper I

DAX Running Totals

I'm not sure if I have missed this somewhere but is it possible to create a DAX running total ignoring 'Weekends'? Using the Northwind Odata as an example, could an RT be calculated against the Freight column that counts 60 working days (Mon - Fri). Starting 04/07/2016, 60 Working days would end 25/09/1996. 

Thanks for any help on this.

 

4 REPLIES 4
gmsamborn
Super User
Super User

Hi @NGC48 

 

I created a calculated column in my date table.

 

WorkDay Offset = 
VAR _d = NETWORKDAYS( TODAY(), 'Date'[Date], 1 ) - 1
RETURN
    IF( _d < 0, _d + 2, _d )

 

 

After creating a 1:* relationship between 'Date'[Date] and 'Sales'[Date], I created these measures.

 

Freight = SUM( 'Sales'[Freight] )

60 weekdays = 
VAR _Offset = SELECTEDVALUE( 'Date'[WorkDay Offset] )
VAR _Result =
    CALCULATE(
        MAX( 'Date'[Date] ),
        FILTER(
            ALL( 'Date' ),
            'Date'[WorkDay Offset] = _Offset + 60
        )
    )
RETURN
    _Result

Freight 60 = 
VAR _Start = SELECTEDVALUE( 'Date'[Date] )
VAR _End = [60 weekdays]
VAR _Result =
    CALCULATE(
        SUM( 'Sales'[Freight] ),
        DATESBETWEEN(
            'Date'[Date],
            _Start,
            _End
        )
    )
RETURN
    _Result

 

Let me know if this helps.

 

Running Freight Total for 60 weekdays.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

Thansk @gmsamborn. Trying to create a cumualative RT.  Your sample data includes Freight cost for 'weekends'. In my data (Sat,Sun) would not have any values as they are non-operational days. But has given me food for thought.

Regards.

parry2k
Super User
Super User

@NGC48 see if this video help to find the solution: How to calculate shipping date based on the working date ignore non working days - Power BI - YouTub...



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks @parry2k , will give this a watch.

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.