March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
If I have a table like
Col1 Col2
a 1
a 1
a 1
b 3
b 3
b 3
c 5
c 5
How would I calculate the sum of Col2 based on unique Col1 (i.e in this example sum = 9)
I have tried
and calculate(sum('table'[Col2], filter('table', distinct('table'[Col1]))))
Solved! Go to Solution.
In your data, if Col1 is a, will Col2 always be 1?
If not, you'll need to figure out some way to decide which Col2 is the correct value to use in the sum. Otherwise, you can use this:
SumByCategory = SUMX(DISTINCT(Table[Col1]),FIRSTNONBLANK(Table[Col2],[Col2]))
Thanks, that works!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
116 | |
77 | |
58 | |
52 | |
46 |
User | Count |
---|---|
170 | |
117 | |
63 | |
56 | |
51 |