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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Filtering a cumulative function

Hi, 

 

I have encountered a problem using my cumulative function. Apparently, the function is taking all the previous sessions. In other words, it is not filtered by my calendar slicer whereas the bar chart is: 

AndrejBI_1-1599487789869.png

In the above picture you can see that it is not starting from a zero nor from the first number in the bar chart. To be specific, it takes all the previous numbers from the data table: 

AndrejBI_2-1599487867102.png

The first data point in the cumulative line should be something around 6k.  This is the cumulative function I used: 

 

 

Total Revenue cumulative = 
    CALCULATE(SUM([Revenue]),
    FILTER(ALL('Calendar'),
    'Calendar'[DateKey]<= MAX('Calendar'[DateKey])))

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Not very clear. Try like

Total Revenue cumulative =
CALCULATE(SUM([Revenue]),
FILTER(ALLSELECTED('Calendar'),
'Calendar'[DateKey]<= MAX('Calendar'[DateKey])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

@Anonymous - Without sample data or more information it is hard to say. I would say that it is not correct because you should use ALLSELECTED or ALLEXCEPT except that if you used ALL, then you numbers should be higher than your value for that first day if you were filtering. Any chance you can share the PBIX or more information on what you have as fields/filters in/on that visual? 

 

Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Anonymous , Not very clear. Try like

Total Revenue cumulative =
CALCULATE(SUM([Revenue]),
FILTER(ALLSELECTED('Calendar'),
'Calendar'[DateKey]<= MAX('Calendar'[DateKey])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@Anonymous , do you need more help on this

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks @amitchandak and @Greg_Deckler, I resolved the issue using ALLSELECTED formula. Nevetheless, I encountered another problem, the revenue is using the same y-axis for bar data (normal) and line data (cumulative). Is there any way to add the second y-axis? 

AndrejBI_0-1599552171319.png

 

@Anonymous - Yes, check under Y-Axis in Formatting pane (paint roller) scroll way, way down, there is an option for Show secondary

Greg_Deckler_0-1599574206622.png

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 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.

Top Solution Authors