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

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

Reply
vemishetti123
Frequent Visitor

undefined

vemishetti123_1-1705568503047.png

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
vemishetti123
Frequent Visitor

vemishetti123_0-1705582573946.png

 

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.




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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.