Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hey, everyone!
My table follows this structure:
Cod | Name | Weight |
XXX | example | 10 |
XXX | example | 10 |
YYY | example | 20 |
ZZZ | example | 35 |
ZZZ | example | 35 |
AAA | example | 4 |
CCC | example | 8 |
As you can see, it contains a column that has repeated values (Cod column). I wante to create a calculated column that SUMS all the values in the Weight column, but doing this sum by DISTINCT Cod. So the final SUM whould be 10 + 20 + 35 + 4 + 8 = 77.
Can someone help me?
Solved! Go to Solution.
Hello
You can download my PBI file from here.
I hope this helps.
Hello
You can download my PBI file from here.
I hope this helps.
@Anonymous , Try a measure like
measure= sumx(summarize(Table,Table[Cod],Table[Name],Table[Weight]),[Weight])
or
measure= sumx(summarize(Table,Table[Cod],Table[Name],"_1", max(Table[Weight])),[_1])
Hi @Anonymous
Download example PBIX file here
Not sure it makes sense to create a column for a result that is a single value?
In Power Query use this code to get the result
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WioiIUNJRSq1IzC3ISQWyDA2UYnVwCkdGRqIIG0GEo6KiUISNTfEJOzo6ogibgEWdnZ1RRC2UYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Cod " = _t, #"Name " = _t, Weight = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Weight", Int64.Type}}),
#"Removed Duplicates" = Table.Distinct(#"Changed Type", {"Cod "}),
Total = List.Sum(#"Removed Duplicates"[Weight])
in
Total
Starting with this
Result
Regards
Phil
Proud to be a Super User!
Hi, @PhilipTreacy
Thanks for the response!
I gave the initial idea of being a column, but it works better if it was a measure.
The final result I would like is a measure that shows the sum of all values in the Weight column, but only counting the distincts Cods. So, based on the example table above, the final result of the measure would be 77.
I already did the SUM part, but I don't know how to do the SUM by DISTINCT Cods.
Right now, my measure is like this:
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.