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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
timo980111
Frequent Visitor

Stock level Calculation

Hi guys,

I'm new at DAX, but I can't find any solution that fits for my problem. 

Maybe one of you can help me. 

I would like to calculate my future stock level based on the following table.

timo980111_0-1669730963057.png

The last available stock is index 29. After that I would like to calculate the stock.

My idea is to calculate the stock level with the following formular: Stock[x]= (Stock[29] + SUM(DELTA[29:X]). 

Could someone please help me with the DAX?

 

3 REPLIES 3
NikhilChenna
Skilled Sharer
Skilled Sharer

Hi @timo980111 , Please use the below,

 

Calculated column  = 
var index29stock = CALCULATE( MAX('table1'[BESTAND]), FILTER( 'table1'[Index]=29))

var futurestock = index29stock + 'table1'[delta]

RETURN

futurestock

 

Regards,

Nikhil Chenna

 

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

Unfortunately it's not working - Just to clarify I need the following formular as DAX:

Example for index31 -> stock31 = index29stock + Delta29 + Delta30 + Delta31.

Example for index32 -> stock32 = index29stock + Delta29 + Delta30 + Delta31.

Hi, @timo980111 

Please try formula like:

Measure1 =
VAR stock29 =
    CALCULATE ( [M_stock], FILTER ( Table1, Table1[Index] = 29 ) )
RETURN
    SUMX (
        FILTER (
            ALL ( Table1 ),
            Table1[Index] <= MAX ( Table1[Index] )
                && Table1[Index] >= 29
        ),
        [M_DELTA]
    ) + stock29

Best Regards,
Community Support Team _ Eason

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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