Forum Discussion
amansinghfirstb
5 years agoHelper III
Problem in getting % change values
This has been one harrowing tale where so far I have tried every trick in the book to get the answer but nothing has worked so far. I want something like column F( which uses created column G). The highlighted cells are given and I need column F through DAX.
column F calculates the % order change in the current week wrt the average order for the previous weeks. As you can see
15 Replies
- DataInsightsSuper User
Try these measures:
Total Qty = SUM ( Orders[Qty] ) % Change = VAR vShipWk = MAX ( Orders[Schedule Ship Wk] ) VAR vDistinctShipWk = ALL ( Orders[Schedule Ship Wk] ) VAR vPrevShipWk = FILTER ( vDistinctShipWk, Orders[Schedule Ship Wk] < vShipWk ) VAR vPrevShipWkQty = ADDCOLUMNS ( vPrevShipWk, "TotalQty", [Total Qty] ) VAR vAverage = AVERAGEX ( vPrevShipWkQty, [TotalQty] ) VAR vResult = DIVIDE ( [Total Qty] - vAverage, vAverage ) RETURN vResult- amansinghfirstbHelper III
This is not coming out right.
- DataInsightsSuper User
Line 9 should use [Total Qty].
Line 11 should use [TotalQty] (no space).
It's best practice not to precede measures with a table name.