Forum Discussion

amansinghfirstb's avatar
amansinghfirstb
Helper III
5 years ago

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

  • amansinghfirstb,

     

    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