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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
romeo
Frequent Visitor

DAX sum column referring to itself

Hello,
I'm having trouble writing a working DAX formula in Power BI that should sum up previous values in the same column.
In Excel it can easily be solved (not if the data is an actual table tho) --> I attached the excel file including my formula.

Maybe someone knows the answer and could help 🙂

 

https://drive.google.com/drive/folders/181jeOfllqmWO1VIIQ8lMpJ0iezT9AgaQ 


DAX.png

 

Explanation:
The table contains the current stock for several items as well as future planned production quantities (which increase the stock) and sales orders (which decrease the stock).
For each item there is some basic information like minimum stock and production lot sizes.
Calculating the cumulated quantity is easy but now I would like to add a column in which production runs are proposed if the cumulated quantity falls below the minimum stock. In this case it should calculate the needed quantity in order to fill the stock above minimum stock (considering the production lot sizes).
I am struggling because in this case I need to consider the cumulated quantity as well as possible previous production proposals.

I'm not sure whether a calculated column or a measure or editing the data in power query is the best way to solve this.
But later on I would like to show all production proposals on a visual without filtering to a specific date.

PS: the attached Excel example contains 1 item only, but in reality there could be several items.

 

Thank you so much!

2 REPLIES 2
Anonymous
Not applicable

Hi @romeo 

So the three columns [Quantity], [Quantity cumulated], [Production proposal] are regular columns or calculated columns? Is the value of [Quantity cumulated] the result you want ? Can you directly provide the result you want, and his calculation logic ?

 

Best Regards,
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Ailsa Tao,

 

Firstly thank you for taking the time to deal with my issue.

The column [Quantity] is a value column, whereas [Quantity cumulated] and [Production proposal] are calculated columns.
The example I shared contains pretty much the solution I am looking for:
I would like to cumulate [Quantity] and check if it's below the defined minimum stock.
If so, the column [Production proposal] calculates the quantity needed to fill up the stock.
The formula for [Production proposal] should more less be like this: [Quantity cumulated]+previous production proposals. 

I don't know how to calculate something with consideration of previous calculation results in the same column and I'm not even sure if this is possible. Any other approach would be fine by me (more calculated columns or other solutions in Power Query or the SQL statement).

Cheers

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.