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

Inventory running total

I am trying to replicate the ERP stock transactional history table and then want to visualize it in a graph.

 

So we have the current stock level and the inventory transaction history.

 

I would like to show a graph of the inventory level therefore want to calculate the inventory running total.

 

The current stock level is 17 therefore the first lines running total = 17

 

Running Total = Previous lines Running Total - Previous lines TotalQty

 

PartNumTranDateTranNumTranTypeOnhandQtyQtyTotalQtyRunning Total
Part 000101/06/201810716074STK-MTL17-1-117
Part 000101/06/201810716075STK-MTL17-1-118
Part 000101/06/201810716076STK-MTL17-1-119
Part 000101/06/201810716077STK-MTL17-1-120
Part 000101/06/201810716078STK-MTL17-1-121
Part 000101/06/201810716079STK-MTL17-1-122
Part 000101/06/201810716080STK-MTL17-1-123
Part 000131/05/201810716071PUR-STK17252524
Part 000130/05/201810713112STK-CUS17-1-1-1
Part 000123/05/201810703893ADJ-QTY17330
Part 000123/05/201810703894STK-MTL17-1-1-3
Part 000123/05/201810703896STK-MTL17-1-1-2
Part 000123/05/201810703898STK-MTL17-1-1-1
Part 000123/05/201810703899STK-MTL17-1-10
Part 000115/05/201810497083STK-MTL17-1-11
Part 000114/05/201810496626STK-MTL17-1-12
Part 000108/05/201810484078STK-MTL17-1-13
Part 000108/05/201810484454STK-MTL17-1-14
Part 000108/05/201810485071STK-MTL17-1-15
Part 000108/05/201810485441STK-MTL17-1-16
Part 000108/05/201810486266STK-MTL17-1-17
Part 000108/05/201810486603STK-MTL17-1-18
1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Sharksguts

Create an index column from 0 in query editor.

Then create two calculated columns

Column1 = CALCULATE(SUM(Sheet1[TotalQty]),FILTER(ALL(Sheet1),[Index]<EARLIER([Index])))
Column2 = [OnhandQty]-[Column1]

5.png

 

Best Regards

Maggie

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Sharksguts

Create an index column from 0 in query editor.

Then create two calculated columns

Column1 = CALCULATE(SUM(Sheet1[TotalQty]),FILTER(ALL(Sheet1),[Index]<EARLIER([Index])))
Column2 = [OnhandQty]-[Column1]

5.png

 

Best Regards

Maggie

alexei7
Continued Contributor
Continued Contributor

Hi @Sharksguts,

 

How is your table sorted?

From the data below I can't see anything obvious and I think we need to know this to help with this formula.

 

Thanks

Alex

Good point,

 

The table would be sorted PartNum(Ascending), TranDate(Descending), SysTime(Descending)

 

The Running Total would be reset on the PartNum changing.

 

PartNumTranDateSysTimeTranTypeOnhandQtyQtyTotalQtyRunning Total
PART-000101/06/201843202STK-MTL17-1-117
PART-000101/06/201843230STK-MTL17-1-118
PART-000101/06/201843259STK-MTL17-1-119
PART-000101/06/201843288STK-MTL17-1-120
PART-000101/06/201843316STK-MTL17-1-121
PART-000101/06/201843343STK-MTL17-1-122
PART-000101/06/201843368STK-MTL17-1-123
PART-000131/05/201842843PUR-STK17252524
PART-000130/05/201857220STK-CUS17-1-1-1
PART-000123/05/201837981ADJ-QTY17330
PART-000123/05/201838008STK-MTL17-1-1-3
PART-000123/05/201838034STK-MTL17-1-1-2
PART-000123/05/201838058STK-MTL17-1-1-1
PART-000123/05/201838083STK-MTL17-1-10
PART-000115/05/201829635STK-MTL17-1-11
PART-000114/05/201858672STK-MTL17-1-12
PART-000108/05/201849447STK-MTL17-1-13
PART-000108/05/201850725STK-MTL17-1-14
PART-000108/05/201852428STK-MTL17-1-15
PART-000108/05/201853770STK-MTL17-1-16
PART-000108/05/201855161STK-MTL17-1-17
PART-000108/05/201857792STK-MTL17-1-18

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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