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))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

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.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.