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

Sum based on unique ID

Hi Guys,

 

I have a problem which shouldnt be that difficult to solve, but I'm new to DAX and can't handle it.

 

What I am searching for is the Sum of values based on a ID. 
Example:

ID | VALUE

1      1 

1      2 

2      3

2      3

3      4

3      1 

3      3

 

Result should be

ID 

1 =3

2 = 6

3 = 8

11 REPLIES 11
v-frfei-msft
Community Support
Community Support

Hi @Anonymous,

 

What is your excepted result then?

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
v-frfei-msft
Community Support
Community Support

Hi @Anonymous,

 

Does that make sense? If so, kindly mark my answer as a solution to close the case.

 

Regards,
Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

@v-frfei-msft how does your answer differs from mine? 

Ashish_Mathur
Super User
Super User

Hi,

 

Drag ID to the Table visual and write this measure

 

=SUM(Data[Value])

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-frfei-msft
Community Support
Community Support

Hi @Anonymous,

 

One sample for your reference. Here I create a calculated table using the formula.

 

Table = SUMMARIZE(Table1,Table1[ID],"ID ",Table1[ID]&"="&SUM(Table1[VALUE]))

The result as below:

 

Capture.PNG

 

If it doesn't meet your requirement, please refer to Table2.

 

Table2 = SUMMARIZE(Table1,Table1[ID],"ID ",SUM(Table1[VALUE]))

2.PNG

For more details, please check the pbix as attached.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

If you put it in a table in PowerBI you get your results right? Why do you need it in an aggregated format? It will do it at "run time"

 

 

Otherwise you can Add a table in PowerBI with the following DAX:

Table = SUMMARIZE(Sheet1; Sheet1[ID]; "Total Value"; sum(Sheet1[VALUE])) 

This code will return an aggregated table. 

Anonymous
Not applicable

I would like to have it as a measure instead as a additional column in the table.. The GroupBy Function also doesnt work, it doesnt add the values though I selected it.. 

PattemManohar
Community Champion
Community Champion

It is again a similar issue as below.

 

Please follow the below link, (Solution without using DAX)

 

https://community.powerbi.com/t5/Desktop/max-date-for-each-source-from-a-folder/m-p/522111#M244267

 

 

.InputInputOutputOutput

 

 





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

Proud to be a PBI Community Champion




Can you try the following code: 

 

SUMMARIZECOLUMNS(Tags[value], "ID", COUNT(Tags[value]))

https://msdn.microsoft.com/en-us/query-bi/dax/summarizecolumns-function-dax  

Anonymous
Not applicable

Thanks for your answer. Im getting the following Error:

"The expression refers to multiple columns. Multiple Columns cannot be converted to a scalar value"

 

 

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.