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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Rolling sum (running total) calculated also for future months and cannot be filtered

Hi all,

 

could you please help me with my measure I have for a 12M rolling sum? I got this measure defition on the internet and it computes the numbers fine. But I cannot achieve to change the measure so that I can filter out the months for which I do not have any data, especially those future months that are displayed due to the 12M measure..

 

Any idea please? Thank you very much

img.JPG

Formula:

OI_12m_roling_m_rate =

IF(
ISFILTERED('Dates'[Date]),
ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
VAR __LAST_DATE = ENDOFMONTH('Dates'[Date].[Date])
VAR __DATE_PERIOD =
DATESBETWEEN(
'Dates'[Date].[Date],
STARTOFMONTH(DATEADD(__LAST_DATE, -11, MONTH)),
ENDOFMONTH(DATEADD(__LAST_DATE, 0, MONTH))
)
RETURN
SUMX(
CALCULATETABLE(
SUMMARIZE(
VALUES('Dates'),
'Dates'[Date].[Year],
'Dates'[Date].[QuarterNo],
'Dates'[Date].[Quarter],
'Dates'[Date].[MonthNo],
'Dates'[Date].[Month]
),
__DATE_PERIOD
),
CALCULATE(
SUM(Data[Actual Net Sales M rate]),
ALL('Dates'[Date].[Day]
)
)
)

6 REPLIES 6
AlB
Community Champion
Community Champion

Hi @Anonymous 

Try returning blank when the value for the months that don't have data. Something like:

 

Measure = 
IF( Current Month is not blank, [Your Current Measure ])

 and make sure the chart doe not show blanks. Or you could also check that you are not in the future:

Measure = 
IF( MIN(Date[Date]) <= TODAY(), [Your Current Measure ])

or a combination of both 

Anonymous
Not applicable

HI @AlB ,

 

thank you very much for your quick response. Unfortunately, this did not help, I have already tried that. I also tried different 12M rolling sum measure definitions but have not achieved to get the desired result.

 

What I would need is 12M rolling sum measure to display in a chart where I could use filters from left or right adn where the chat will not display future months. I also tried the one mentioned below which does not give me 12M sum but only the current month value...

 

If you have any other tip, I would be really glad as I have already tried various options but still nothing 😕

 

Thank you very much

 

orders_invoiced_rolling_sum_12M chart2 = 

CALCULATE (
    SUMX (Data,Data[Actual Net Sales M rate] ),
    DATESBETWEEN (
        Dates[Date],
        NEXTDAY( ( SAMEPERIODLASTYEAR ( LASTDATE ( Dates[Date]) ) )),
        LASTDATE ( Dates[Date] )
    )
)

img2.JPG

AlB
Community Champion
Community Champion

Can you share the pbix so that I can have a look? 

Can you also explain this a bit more, perhaps with an example? 

What I would need is 12M rolling sum measure to display in a chart where I could use filters from left or right adn where the chat will not display future months.

Anonymous
Not applicable

Hi,

 

thanks. I have already achieved to get rid of the future months (I had some other filters applied on the report level which caused this issue ..my bad..)

 

Anyway i am still not sure how to avoid those blank months at the beginnign as I cannot use date filter on the chart that contains date hierarchy and a measure relied on it.

 

Is there a way to attach/post the Pbix file here? I cannot see the option anywhere 🙂 I created an example with just a data sample.

Many thanks!

Johny B

 

AlB
Community Champion
Community Champion

 

You have to share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like tinyupload.com (no sign-up required).

Anonymous
Not applicable

Hi,

 

thank you for your reply. You can find the example here:

http://s000.tinyupload.com/?file_id=25466564158205816040

Thank you very much for any advice!

Johny

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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