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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
skutovicsakos
Helper I
Helper I

SUM Rows Correctly When Filters Applied

Let's start with the data for demontration:

 

iddatasizeactionCustom column mentioned belowcategory
19create3category1
19read3category1
28create4category2
19read3category1
28read4category2
310create10category1

 

The goal is to sum the datasize for all category, but if I simply sum the datasize column, then the same document's size is being summed multiple times, which is obviously not good. Therefore, I came up with the following custom column that divides the datasize by number of rows with the same id:

DocumentUsage[Datasize]  / CALCULATE(COUNTROWS(DocumentUsage), ALLEXCEPT(DocumentUsage, DocumentUsage[DataID]))

 

It shows the size correctly, until I use filters on the action column. For example, if only "read" is selected, then the document (with id=1) sum gets reduced to 6 instead of 9, because the line with "create" action is no longer being summed.

 

How can I show the datasize correctly every time, when other filters are being applied as well?

 

1 ACCEPTED SOLUTION

Hi,

You do not need a calculated column formula.  Try this measure

Min datasize = MIN(Data[Datasize])

Measure = SUMX(SUMMARIZE(VALUES(Data[Id]),Data[Id],"ABCD",[Min datasize]),[ABCD])

Hope this helps.


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

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

What result are you expecting when Read is selected?  There are 2 ID's for Read - 1 and 2.  Should the answer be 9+8 = 17?

Please clarify.


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

Hi @Ashish_Mathur ,

Yes, that is correct. 

Maybe the I downgraded the probelem way too much. I have an additional category column which I am curious about. 

 

iddatasizeactionCustom column mentioned belowcategory
19create3category1
19read3category2
28create4category2
19read3category1
28read4category2

 

so the question I am trying to answear is the following: what is the datasize sum for each category, but obviously each document should be counted only once.

Hi,

You do not need a calculated column formula.  Try this measure

Min datasize = MIN(Data[Datasize])

Measure = SUMX(SUMMARIZE(VALUES(Data[Id]),Data[Id],"ABCD",[Min datasize]),[ABCD])

Hope this helps.


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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.