Forum Discussion

amirghaderi's avatar
amirghaderi
Icon for Helper IV rankHelper IV
5 years ago
Solved

Rolling Sum - Last period

I have a rolling sum measure as below which measures 3 weeks rolling of column "periodic:Earned". I want another measure which only calculate the the last period rolling sum and everything else to be zero. For example, in the below table, only shows the rolling sum for 16-Apr-21 (26.07) and all previous periods to be zero.

Can somebody help?

 

 

  • Jihwan_Kim's avatar
    Jihwan_Kim
    5 years ago

    Hi, amirghaderi 

    I am not sure hour your whole data model looks like, but the simplest way (in my opinion) is, adding an IF condition something like below.

     

    Qty total 21days rolling =
    if ( not isblank( [Qty total]), your measure......)

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM

     

5 Replies

  • Hi, amirghaderi 

    Please check the below picture and the sample pbix file's link down below.

    All measures are in the sample pbix file.

     

     

    Only show last period rolling total =
    VAR lastdateinperiod =
    CALCULATE ( MAX ( Qty[Date] ), ALL ( Qty ) )
    RETURN
    CALCULATE (
    [Qty total 21days rolling],
    KEEPFILTERS ( Dates[Date] = lastdateinperiod )
    )
     
     
     
     

    Hi, My name is Jihwan Kim.


    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


    Linkedin: www.linkedin.com/in/jihwankim1975/

    Twitter: www.twitter.com/Jihwan_JHKIM

    • amirghaderi's avatar
      amirghaderi
      Icon for Helper IV rankHelper IV

      Not sure why "Qty total 21 days rolling comes blank. 

       

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Icon for Super User rankSuper User

        Hi, amirghaderi 

        I think, in your table visualization, the Dates[Date] is not used. Instead, [Date to 2] is used. 

         

        Hi, My name is Jihwan Kim.

         

        If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

         

        Linkedin: linkedin.com/in/jihwankim1975/

        Twitter: twitter.com/Jihwan_JHKIM