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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ANTBressi
Regular Visitor

Sum of values in one column based on another columns values, Keep getting grand total

Hello,

 

I feel I have been on here too long working this one which seems that it should be way simpler. I have two tables

Table 1

Truck#

Points
124
136
130
215
212
360
448
412
410

 

Need table 2 to show Total points column.

Truck#Total Points
190
227
360
470

 I need this to be a calculated column, and I feel I am close but I cannot get what i need. I use the following DAX for calculated column in table 2: I have a many to one relationship from table 1 to table 2 truck #.

 

SUMX(GROUPBY('Table 1,'Table 1'[Truck #],'Table 1'[RPN]),'Table 1'[Points])
 
This however gives me the grand total of points for all trucks for each truck i.e.:
Truck #Total Points
1247
2247
3247
4247

 

I have spent few too many hours for something I feel is so simple. Please help! Thank you!

 

1 ACCEPTED SOLUTION

The syntax I gave is to create new table syntax

View solution in original post

5 REPLIES 5
ANTBressi
Regular Visitor

I tried making a calculated column out of this, I got an error that the expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

 

The syntax I gave is to create new table syntax

So, I realize that coffee does have diminishing returns, hahahahaha. Thank you for your patience with me, I got what I needed! Thank you.

Column: (in 'Table')

If you are looking for sum by category type of formula i.e., adding a column to the original table, then you can try this. Create a new column in Table 1 as below.

 
Sum by Category As Column = CALCULATE( sum('Table'[points]) , Filter('Table', 'Table'[Truck#] = EARLIER('Table'[Truck#])))

 

Measure: (in 'Table')

points total for Truck# 2 =
var _t = SELECTEDVALUE('Table'[Truck#])
return IF ( HASONEVALUE('Table'[Truck#]), CALCULATE(SUM('Table'[points]), 'Table'[Truck#] = _t), SUM('Table'[points]))
 
I believe you need a measure, not a column. But provided both syntax. 
sevenhills
Super User
Super User

To understand Group by, check this link: https://dax.guide/groupby/

 

Below gives the number of entries by Truck#:

Table 2 = GROUPBY('Table','Table'[Truck#], "Points", Sumx( CURRENTGROUP(), 1))
 
Below gives the total you want i.e., Sum of Points by Truck #:
Table 2 = GROUPBY('Table','Table'[Truck#], "Points", Sumx( CURRENTGROUP(), 'Table'[points]))
 
 
 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.