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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Tripb44
Helper II
Helper II

Running Total for Calculated Column

I am trying to calculate the remaining qty needed to be shipped per order -> per line.  Below is an example of the date structure with "Current Output for Remaining Qty" as a column simply taking (Qty Needed For Order Line - Shipped Qty) and I've added a "Desired Output for Remaining Qty" as what I am in need of for a calculated column. 


Tripb44_0-1640883731298.png

 

4 REPLIES 4
Anonymous
Not applicable

Hi @Tripb44 ,

 

Check the column.

Column = 
var min_index = CALCULATE(MIN('Table'[index]),FILTER('Table','Table'[ordernum]=EARLIER('Table'[ordernum])&&'Table'[orderline]=EARLIER('Table'[orderline])))
var order_qty = CALCULATE(SUM('Table'[sellingorderqty]),FILTER('Table','Table'[index]=min_index))
var ship_qty = CALCULATE(SUM('Table'[sellingshipqty]),FILTER('Table','Table'[ordernum]=EARLIER('Table'[ordernum])&&'Table'[orderline]=EARLIER('Table'[orderline])&&'Table'[index]<=EARLIER('Table'[index])))
return
order_qty-ship_qty

Capture.PNG

 

Best Regards,

Jay

Anonymous
Not applicable

Hi @Tripb44 

 

You are looking at order number and order line, right? Can you add an index column in Power Query? one way...

Vera_33_0-1640921500967.png

Remaining Qty = 
VAR totalShippedQty=SUMX(FILTER('Table','Table'[OrderNum]=EARLIER('Table'[OrderNum])
    &&'Table'[OrderLine]=EARLIER('Table'[OrderLine])
    &&'Table'[Index]<=EARLIER('Table'[Index]))
    ,'Table'[Shipped Qty])
RETURN
'Table'[Qty Needed]-totalShippedQty

 

Hi, thanks for your comment. I have pasted a snip of the output using live data.  Highlighted in red is my current output, highlighted in green is my desired output for the “Rem Qty” and “Rem Total” columns.  Highlighted in orange is the output of your recommended calculated column.  Above the excel output is the calculated column dax for your recommendation.  In answer to your question, yes, I want to group by order number and order line.  Each order line can have multiple order releases such as the example I am showing here.  Desired output and use for this will be to have a date interval selected and capturing the remaining qty left to be shipped and the associated dollar value.  Thank you for your time and help on this, it is greatly appreciated.




Tripb44_0-1640949689337.png

 

Anonymous
Not applicable

Hi @Tripb44 

 

It's wierd...can't repreduce your result, added two rows for testing, or does column Rank matter?

Vera_33_0-1641196266237.png

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors