Forum Discussion
Subtracting rows
- Anonymous7 years ago
Anonymous ,
We don't need to create Table2. Please group Material in Power BI Desktop query editor, then create the following columns in table1. For more details, please check attached PBIX file.shipcum = CALCULATE(SUM (Table1[To Ship] ), ALLEXCEPT( Table1,Table1[Material]), Table1[Index] <= EARLIER ( Table1[Index] ))Column = CALCULATE(MAX(Table1[Inventory on Hand]),ALLEXCEPT(Table1,Table1[Material]),Table1[Index]=1)
After shipping = Table1[Column]-Table1[shipcum]
Regards,
Lydia
Hi Lydia,
It looks like below, using above. Any idea what is wrong?
//Rasty
Anonymous ,
Please firstly create a new table using dax below.
Table2 = SUMMARIZE(Table1,Table1[Material],Table1[Ship Date],"To ship all",SUM(Table1[To Ship]),"Inventory on Hand all", MAX(Table1[Inventory on Hand]))
Create the following columns in Table2.
mergecol = Table2[Material]&Table2[Ship Date]
Column =
CALCULATE (
SUM ( Table2[To ship all] ),
ALLEXCEPT( Table2,Table2[Material]),
Table2[Ship Date] <= EARLIER ( Table2[Ship Date] )
)
after shipping = Table2[Inventory on Hand all]-Table2[Column]
Create the following column in Table1.
mergecol = Table1[Material]&Table1[Ship Date]
Create relationship between tables using mergecol field. Then create a table visual as below. For more details, please check attached PBIX file.
Regards,
Lydia
- Anonymous7 years agoNot applicable
Hi Lydia,
This is very impresive, very close but, I would desire more as below.
Thanks.
- Anonymous7 years agoNot applicable
Anonymous ,
We don't need to create Table2. Please group Material in Power BI Desktop query editor, then create the following columns in table1. For more details, please check attached PBIX file.shipcum = CALCULATE(SUM (Table1[To Ship] ), ALLEXCEPT( Table1,Table1[Material]), Table1[Index] <= EARLIER ( Table1[Index] ))Column = CALCULATE(MAX(Table1[Inventory on Hand]),ALLEXCEPT(Table1,Table1[Material]),Table1[Index]=1)
After shipping = Table1[Column]-Table1[shipcum]
Regards,
Lydia