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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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