Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Running 13 weeks total based on selected quarter

 

   I want to calculate the running 13 weeks RP Qty sum.

 

   For Example if i select Q2 FY22 in the version quarter filter , W1 should have the RP Qty data for next 12 weeks including W1 , W2 should have the data for next 12 weeks including W2 and so on! W1 is dervied from the cersion quarter(Custom Column)

   Kindly help and thanks in Advance

  • Anonymous , if you can create week rank (if need across qtr) then oon week start date else on on qtr week no

     

    Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
    OR
    Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format

     

    Last 12 weeks = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])&& 'Date'[Week Rank]<=max('Date'[Week Rank]) +12 ))

3 Replies

  • Anonymous , if you can create week rank (if need across qtr) then oon week start date else on on qtr week no

     

    Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
    OR
    Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format

     

    Last 12 weeks = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])&& 'Date'[Week Rank]<=max('Date'[Week Rank]) +12 ))

  • Anonymous's avatar
    Anonymous
    Not applicable

    First of all thank you Amit for taking time to respond on this.

     

    The problem is i dont have the week start or the Year week columns ! Even i dont have the date field & i am getting the below error!.

     

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI Amit,

        I identifies that there is one filed already in the cube for the week rank and was hidden . I Used that and it worked as you explained.

       Thank you.