Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Calculate Non-Rolling 13 Week SUM

Hello, I'm trying to find a formula that will calculate a static, non-rolling, SUM of the previous 13 weeks of ordered units. Once I can SUM the last 13 weeks of the Ordered and Confirmed Quantities...
  • v-lid-msft's avatar
    v-lid-msft
    7 years ago

    Hi Anonymous ,

     

    Your formula works fine with the filter on my side, this formula had considered the outer slicers.

     

    Non-rolling 13 WK Confirmation Rate = 
    Var t = 
        ADDCOLUMNS (
            ALLSELECTED( 'Table'),
            "WeekIndex", RANKX ( ALLSELECTED ( 'Table' ),[Week of Year],, DESC )
            )
    Var i =
        MAXX (
            FILTER ( t , 'Table' [Week of Year] = MAX ('Table' [Week of Year] ) ),
            [WeekIndex] 
            )
    RETURN
        CALCULATE (
            SUM ('Table'[Confirmed Quantity] ),
            FILTER ( t, [WeekIndex] <= i + 12 && [WeekIndex] >= i )
            )
            / CALCULATE (
                SUM ('Table'[Ordered Qty] ),
                FILTER ( t, [WeekIndex] <= i + 12 && [WeekIndex] >= i )
            )

     

     


    BTW, pbix as attached.

     

    Best regards,

    Community Support Team _ Dong Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.