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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
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

PBI_APRIL_CAROUSEL1

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.