The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
77 | |
71 | |
48 | |
41 |
User | Count |
---|---|
137 | |
108 | |
69 | |
64 | |
58 |