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
Anonymous
Not applicable

Sumx to sum values for each unique ID in row

Let's say I have this data

Col 1   Col 2

A         10

A         15

B          2

B          6

C         12

A         30

B         12

 

I want to create a measure that is a column that would add up every instance of ID A, B, C and display it

What I am after is shown in column 3 below

Col 1   Col 2   Col 3

A         10        55

A         15        55

B          2         20 

B          6         20

C         12        12  

A         30        55

B         12        20   

So every time there is a row of ID A, column three will show the cumulative total of 55. 

I am trying to do this with a sumx and values function currently but it is not adding up correctly. 

 

1 ACCEPTED SOLUTION
BalaVenuGopal
Resolver I
Resolver I

Hi @Anonymous ,

 

Create new measure as  bellow 

Measure = CALCULATE(SUM(Table1[Col 2]),ALLEXCEPT(Table1,Table1[Col 1]))

 

In report you select col 1 and col 2(Choose dont summarize) and measure will give you required output .

Bellow is screenshot.

Please mark as solution if this works for you.

 

Capture.PNG

View solution in original post

3 REPLIES 3
BalaVenuGopal
Resolver I
Resolver I

Hi @Anonymous ,

 

Create new measure as  bellow 

Measure = CALCULATE(SUM(Table1[Col 2]),ALLEXCEPT(Table1,Table1[Col 1]))

 

In report you select col 1 and col 2(Choose dont summarize) and measure will give you required output .

Bellow is screenshot.

Please mark as solution if this works for you.

 

Capture.PNG

Vvelarde
Community Champion
Community Champion

@Anonymous

 

Hi, you can use this measure:

 

TotalbyColumn1 =
CALCULATE ( SUM ( Table1[Column2] ); ALLEXCEPT ( Table1; Table1[Column1] ) )

Regards

 

Victor

Lima - Peru




Lima - Peru
Anonymous
Not applicable

@Vvelarde Thank you for the quick response. When I tried that formula in a calc column and I go look at that data in the table it shows 1's all the way down for that column. Any idea why? 

 

But when I put this new column in a table it has the correct calculation totals. 

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.