Skip to main content
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.

Frequent Visitor



can anyine help me on this.

I have a table which contains date,weekno,asofstock,fabinflow,cutplan now i need to calculate opening stock for the week53(which is first row) should be the value of asofstock and for the rest of the weeks it should fetch from the closing stock calculated column which was not yet calculated. Now closing stock should be calculate openstock+fabinflow-cutplan(for the first row) and this closing stock should be referred to the open stock of next week and it should repeat the process for the rest of the weeks in power bi
Frequent Visitor



i have used the above formula iand created measure but it is giving me wrong for the week53.

inventory / OnHand =
CALCULATE(FIRSTNONBLANKVALUE(Query1[Week of Year],sum(Query1[closing stock])),all('Query1'))

+ CALCULATE(SUM(Query1[FabInFlow]),FILTER(ALL(Query1),Query1[Week of Year] <=MAXX(Query1,Query1[Week of Year])))

- CALCULATE(SUM(Query1[Cut plan]),FILTER(ALL(Query1),Query1[Week of Year] <=MAXX(Query1,Query1[Week of Year])))

This is the formula i have used.

Super User
Super User

@vemishetti123 , In such case we have to create cumulative measures, prefer using a date table


Inventory / OnHand
CALCULATE(firstnonblankvalue('Date'[Month],sum(Table[Intial Inventory])),all('Date'))

+ CALCULATE(SUM(Table[Ordered]),filter(all(date),date[date] <=maxx(date,date[date])))

- CALCULATE(SUM(Table[Sold]),filter(all(date),date[date] <=maxx(date,date[date])))



Power BI Inventory On Hand:

Helpful resources

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


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.