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 ...
DataInsights
5 years agoSuper 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
amansinghfirstb
5 years agoHelper III
This is not coming out right.
- DataInsights5 years agoSuper 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.
- amansinghfirstb5 years agoHelper III
Thanks, I did the correction, but why am i getting the total like this?
Order Fluctuation% change as 108.81% doesn't make sense. Can I remove it?
- DataInsights5 years agoSuper User
Replace the last line of the measure with this so it will display blank for the total row:
IF ( HASONEVALUE ( Orders[Schedule Ship Wk] ), vResult, BLANK() )