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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
H_Jones
Helper I
Helper I

cumulative sum issues when filtering

I am having some issues with my cumulative sum. I initially thought it was working fine, until I added a date slicer onto the page and now when that is used the sum goes bonkers, I dont even understand the numbers being produced.

 

Here is the measure formula:

Cumulative Pledges = CALCULATE ([Pledges],
FILTER (ALL('Attrition Data'[Attrition Flag]),
'Attrition Data'[Attrition Flag] <= MAX ( 'Attrition Data'[Attrition Flag])
)
)

 

And here is an example of some data where it works great:

 

cumsum1.PNG

 

But when I filter down some of the dates involved in the report here is what I get:

 

cumsum2.PNG

 

So, what is mind-boggeling is that the 'Totals' are correct but the values in the matrix are incorrect, surely this means what I need is possible.

 

Can anyone explain what is going on and how i can fix this?

 

EDIT** Here is a text version of the report and an image of the oncorrect data. I am also having issues using the channel slicer. 

https://1drv.ms/u/s!Ah4C_QyiKS7WkEcGk8E3kPhGzZ4s

image.png

 

Please help!

 

Thanks,

Harriet.

30 REPLIES 30
Ashish_Mathur
Super User
Super User

Hi,

 

Share the link from where I can download the .pbix file and show the expected result as well.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Sorry, I dont know how to make a .pbix file public? I can only share a fake version that i will quickly make of the report as the data is protected.

 

H

MFelix
Super User
Super User

Hi @H_Jones,

 

When using the ALL function on your measure what happens is that the calculations are made based on the total table values and overlaps the filter you have in your visuals so the values it gets return is based on the full table and not on the context.

 

If you want to add a slicer try to change your formula to:

 

Cumulative Pledges =
CALCULATE (
    [Pledges],
    FILTER (
        ALLSELECTED ( 'Attrition Data'[Attrition Flag] ),
        'Attrition Data'[Attrition Flag] <= MAX ( 'Attrition Data'[Attrition Flag] )
    )
)

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



It hasnt changed the values at all unfortunately.

Hi @H_Jones,

 

Can you please give some data sample to provide a better help.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @H_Jones,

 

You are publishing to the wqeb however this don't allow to have a download of the PBIX file can you share it trough Onedrive or Wetransfer, so that can take a copy of the file to make the measure.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



@MFelix@Ashish_Mathur How can I transfer the files to you without specifying email adresses?

 

H (sorry i was away for a week)

Hi @H_Jones,

 

Upload the file to OneDrive/Google Docs and share the download link here.

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @H_Jones,

 

I cannot spot any problem there.  When i change the date slicer, the numbers in the Table change.  What is incorrect there?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur When you change the date slicer the numbers are no longer cumulative. the build up until about half way then start to decrease again?

 

H

Hi @H_Jones,

 

With which specific date settings in teh slicer do you observe that anomaly?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Any which arent the full date rage, for example:

 

image.png

Hi,

 

The problem is happening because of the page leve filter.  If you clear that then the answer is correct.  I tried to incorporate the page leve filter condition in the calculated field formula but with no luck.  I will continur trying.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

OK, brilliant, thank you @Ashish_Mathur

 

The value of '100' it just something I picked at random to indicate they have not cancelled, it could be left blank or changed to something else if thats gets us to the correct result.

Hi @H_Jones,

 

Please check and let me know if changing 100 to blank solves the problem.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur Just checked but it doesnt help.

 

Harriet.

Hi @H_Jones,

 

Try this measure

 

=CALCULATE (
    [Pledges],
    FILTER (ALL(Sheet1[Attrition Flag]),SUM(Sheet1[Attrition Flag])<100&&
				Sheet1[Attrition Flag] <= MAX ( Sheet1[Attrition Flag])
			)
)

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Try this one

 

=CALCULATE (
[Pledges],
FILTER(ALLSELECTED(Sheet1), Sheet1[Attrition Flag]<= MAX ( Sheet1[Attrition Flag] ) ),
VALUES ( Sheet1[Channel] )
)

 

Key here is ALLSSELECTED & Values()

ALLSELECTED  will pass the Attrition Flag and Signup Date Filter or any filter selected in to the running total context

VALUES (Channel) will pass the channel context else it will have the running total on Attrition flag, with all having the same value.

 

 

image.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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