Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
amirghaderi
Helper IV
Helper IV

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?

amirghaderi_0-1619240672378.png

 

 

1 ACCEPTED SOLUTION

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

 

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


Go to My LinkedIn Page


View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi, @amirghaderi 

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

All measures are in the sample pbix file.

 

Picture6.png

 

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

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


Go to My LinkedIn Page


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

amirghaderi_0-1619247244844.png

amirghaderi_1-1619247314170.png

 

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

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


Go to My LinkedIn Page


Thanks for your response, it looks much better now. How can I stop the calculating moving sum for future periods, highighted below?

amirghaderi_0-1619252023477.png

 

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

 

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


Go to My LinkedIn Page


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.