Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I have a column that I had to split which equated to more rows. I currently use the Distinct Count from the ID row for most count based visuals.
I need to get the sum of certain columns but I dont want it to add every row.
ID | Material Used |
1 | 100 |
1 | 100 |
1 | 100 |
2 | 380 |
3 | 421 |
3 | 421 |
4 | 100 |
This should only equal 1001. As you can see, the sum of unique values in the materials column wouldnt work since values may match. The ID column needs to be referenced as the control column.
Hello @Anonymous
I don't know how you want to show it. In my code i take your table, and make a sum of a distincted table and show only the result of that
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTI0MFCK1cHNNgKyjS0gbGMg28TIEINtAlMfCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, #"Material Used" = _t]),
ChangeType = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Material Used", Int64.Type}}),
Sum = List.Sum(Table.Distinct(ChangeType)[Material Used])
in
Sum
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy