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
tracyhopaulson
Resolver I
Resolver I

Need help with DAX running total by PO, reset count by PO

Hello, I am trying to calculate the running total of Qty by POs (not PO lines) using DAX and cannot get it to work.

Here is my data sample and the result I need.  I'm new to Power BI so any help I can get is greatly appreciated.  Thanks

 

Accum.png

 

 

1 ACCEPTED SOLUTION

Thanks HotChilli, the error is on my part.  This is working for me now.  Thanks again for your help with the formula 🙂

View solution in original post

3 REPLIES 3
HotChilli
Super User
Super User

You can do this with a calculated column OR a measure but you need to add an Index (use Power Query Editor) because the DAX engine can't look at your data and decide how to order it without one.

Measure = CALCULATE(sum(TableTest[Qty] ), 
FILTER (
     ALL(TableTest),
     'TableTest'[PO] = MAX('TableTest'[PO]) &&
     'TableTest'[Index] <= MAX ( 'TableTest'[Index] )
))

I made the assumption that your real data has different PO values .

Thank you for your help.  It makes sense to add the index column to create the grouping/ordering.  I tried the formula you suggested and received error "The MAX funtion only accepts a column reference as an argument".  Not sure what I missed!

Thanks HotChilli, the error is on my part.  This is working for me now.  Thanks again for your help with the formula 🙂

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.