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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
shuijgen
Frequent Visitor

calculate new stock value

I have a table with stock values (lm_hoev) which is current value of a certain stock material item. 

production orders requires some amount (vbm1).

I would like to calculate the new stock value for that particular material item. 

So for instance for the first line there is 79 stock value and production requires 10 pieces. The new stock is then 69.

But for the second line the stock value is nog 79 but 69 and for the 3rd line the stock value is 59.

 

i have tried many things. Any help is appreciated.

shuijgen_0-1649413436207.png

 

3 REPLIES 3
amitchandak
Super User
Super User

@shuijgen ,

new column = [us_rsr_hoev] - sumx(filter(Table, [us_rsr_matnr] = earlier([us_rsr_matnr]) && [Index] <= earlier([Index]) ),[us_rsr_vbm1] )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I have made the new calculated column. It took 15 minutes (there are 1.488.575 rows in this table). Column does not result in correct answers. I expect :

1st row: lm_hoev (90) - vbm1 (10) = column (80)  ==> your calc gives -2790

2nd row: column (should have value of 80) - vbm1 (10) = column (70) ==> your calc gives -3010

3rd row: lm_hoev (should have value of 70) - vbm1 (10) = column (60) ==> your calc gives -3060

4th row: lm_hoev (should have value of 60) - vbm1 (10) = column (50) ==> your calc gives -3191

shuijgen_1-1649433090832.png

 

 

extra:

I filter the table every week (so for example this week I filter March 28 - April 4.

ut_rsr_capdate is related with Date table, where Date is the dates mentioned.

 

'public ut_resrmat_capt_Picken'[ut_rsr_capdate] >= MIN(D_DATE[Date]) -7,
'public ut_resrmat_capt_Picken'[ut_rsr_capdate] < MIN(D_DATE[Date]),

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors