cancel
Showing results for
Did you mean:

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Frequent Visitor

## undefined

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
2 REPLIES 2
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

@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: https://youtu.be/nKbJ9Cpb-Aw