Forum Discussion
Tchona
2 years agoRegular Visitor
Power Bi: Calculating variation between diffrent production for the same Item
Hello, I am working on a production report for my company on Power BI. My model has the following table: ProductionTable: ProdID, ItemID, quantity, prodDate. The ProdID column is unique and the It...
Anonymous
2 years agoNot applicable
Hi Tchona ,
Please try the following methods and check if they can solve your problem:
1.Create the sample Table.
2.Create the new measure to calculate.
Variation Measure =
var previ_cost = SUMX(FILTER(ALLSELECTED('ProductionDetailTable'),[ProdID] = MAX('ProductionDetailTable'[ProdID]) - 1 && [TypeOfCost] = MAX('ProductionDetailTable'[TypeOfCost])),[Cost])
VAR CurrentCost = CALCULATE(sum('ProductionDetailTable'[Cost]),FILTER('ProductionDetailTable','ProductionDetailTable'[ProdID]))
RETURN
(CurrentCost - previ_cost)
3.Drag the measure into the Values.
4.The result is shown below.
If the above ones can’t help you get it working, could you please provide more raw data(exclude sensitive data) with Text format and provide the desired result to make a deep troubleshooting? It would be helpful to find out the solution.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.