The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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:
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:
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])))
Solved! Go to Solution.
@Anonymous , Not very clear. Try like
Total Revenue cumulative =
CALCULATE(SUM([Revenue]),
FILTER(ALLSELECTED('Calendar'),
'Calendar'[DateKey]<= MAX('Calendar'[DateKey])))
@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.
@Anonymous , Not very clear. Try like
Total Revenue cumulative =
CALCULATE(SUM([Revenue]),
FILTER(ALLSELECTED('Calendar'),
'Calendar'[DateKey]<= MAX('Calendar'[DateKey])))
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?
@Anonymous - Yes, check under Y-Axis in Formatting pane (paint roller) scroll way, way down, there is an option for Show secondary