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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
janitor048
Helper I
Helper I

Select distinct rows for SUMX for related table

I have two tables.

Releases

ReleaseID

A

B
C

 

Tickets

TicketIDReleaseIDMyValueStuff
1A2xyz1
1A2abc1
2B5xyz2
2B5abc2
3B1xyz3
4C10xyz4

Both tables are related in the data modell via the ReleaseID fields, i.e. the relation is 1:m from table Releases to table Tickets. I am looking for a way to get the sum of MyValue per ReleaseID for distinct values of TicketID. The value of MyValue is guaranteed to be identical for all rows with the same TicketID, those rows only differ by the entries in Stuff. But I want to count each TicketID only once in my sum. 

So the result should be:

ReleaseID

SumMyValue

A

2
B6
C10

 

I guess I would somehow have to combine a SUMX over the RELATEDTABLE plus filtering on distinct values. But I can't get it to work.

Right now all my attempts lead to summing all MyValue values for the rows in Tickets, thus yielding A -> 4, B -> 11, C -> 10.

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@janitor048 try this measure, Table 2  in my measure is table from many side and Table  is from One side

 

Total Value = SUMX ( SUMMARIZE ( 'Table 2', 'Table'[ReleaseID], 'Table 2'[TicketID] ), CALCULATE ( MAX( 'Table 2'[MyValue] ) ) )

 

Would appreciate Kudos 🙂 if my solution helped.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@janitor048 try this measure, Table 2  in my measure is table from many side and Table  is from One side

 

Total Value = SUMX ( SUMMARIZE ( 'Table 2', 'Table'[ReleaseID], 'Table 2'[TicketID] ), CALCULATE ( MAX( 'Table 2'[MyValue] ) ) )

 

Would appreciate Kudos 🙂 if my solution helped.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k thanks for your suggestion.

It works - but I can't yet really figure out why and how. Putting your formula in a measure and then creating a calculated column that uses this measure gives the correct results per row in my "one-side" table.

Putting your formula directly into the calculated column however gives incorrect results.

 

Could you maybe elaborate a bit more on how SUMX does it's magic here?

 

@janitor048 summarize is making the unique row and taking the maximum value of it and then sumx is summing it up. Hope this helps.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors