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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Rolling sum without filter all function

Hi all,

 

Having some problems with my rolling sum function below, I have slicers on the page so when I use the Filter(ALL( function it removes the interaction with the sliders. Is there anyway to calculate rolling sums without FILTER(ALL)?

 

Annual_Numeratorr_Rolling =
var _sum12=
CALCULATE (
SUM ( 'PowerBI(Index)'[Total Return Numerator ("calculated reutrn" tab, Column K)] ),
FILTER (
ALL('PowerBI(Index)'),
EOMONTH ( 'PowerBI(Index)'[Return_id], 0 )
<= EOMONTH(MAX([Return_id]),0)&&EOMONTH('PowerBI(Index)'[Return_id],0)>EOMONTH(MAX([Return_id]),-12)
)
)
return IF(HASONEVALUE('PowerBI(Index)'[Return_id]),_sum12,SUM('PowerBI(Index)'[Total Return Numerator ("calculated reutrn" tab, Column K)]))
1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@Anonymous 

You can change all() to ALLSELECTED()

Before not selected:

Vpazhenmsft_2-1630487018445.png

After the slicer is selected:

Vpazhenmsft_3-1630487034010.png

the ALL function ignores all filters, regardless of where they are coming from. In contrast, the ALLSELECTED function only ignores filters that are coming from the inner query.

This is the difference between all() and ALLSELECTED():

https://community.powerbi.com/t5/Community-Blog/What-s-the-Main-Difference-Between-ALL-amp-ALLSELECTED-DAX/ba-p/1339726

https://mitchellpearson.com/2020/09/14/understanding-row-context-in-dax-and-power-bi/

 

Best Regards,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
V-pazhen-msft
Community Support
Community Support

@Anonymous 

You can change all() to ALLSELECTED()

Before not selected:

Vpazhenmsft_2-1630487018445.png

After the slicer is selected:

Vpazhenmsft_3-1630487034010.png

the ALL function ignores all filters, regardless of where they are coming from. In contrast, the ALLSELECTED function only ignores filters that are coming from the inner query.

This is the difference between all() and ALLSELECTED():

https://community.powerbi.com/t5/Community-Blog/What-s-the-Main-Difference-Between-ALL-amp-ALLSELECTED-DAX/ba-p/1339726

https://mitchellpearson.com/2020/09/14/understanding-row-context-in-dax-and-power-bi/

 

Best Regards,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

amitchandak
Super User
Super User

@Anonymous , have you tried a measure like

 

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD("Date"[Date ],MAX("Date"[Date ]),-12,MONTH))

 

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD("Date"[Date ],eomonth(MAX("Date"[Date ]),0 ),-12,MONTH))

 

tiill last month

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD("Date"[Date ],eomonth(MAX("Date"[Date ]),-1 ),-12,MONTH))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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