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!View all the Fabric Data Days sessions on demand. View schedule
I need to create a measure to distinct Sum the value by ID and show average in the total.
| ID | Code | Value | Quantity |
| 1 | A | 100 | 10 |
| 1 | B | 200 | 12 |
| 1 | B | 200 | 14 |
| 1 | B | 200 | 16 |
| 2 | A | 500 | 18 |
| 2 | A | 500 | 20 |
| 2 | B | 800 | 22 |
| 2 | B | 800 | 24 |
Finally result:
| ID | Value | |
| 1 | 300 | |
| 2 | 1300 | |
| Total | 800 |
Solved! Go to Solution.
Hi Eric,
Try the following:
DistinctSum =
VAR DistinctTableSum =
ADDCOLUMNS (
VALUES ( ExampleTable[ID] ),
"@SumColumn", CALCULATE (SUMX ( VALUES ( ExampleTable[Value] ), ExampleTable[Value] ) )
)
VAR Result =
AVERAGEX (
DistinctTableSum,
[@SumColumn]
)
RETURN Result
Hi Eric,
Try the following:
DistinctSum =
VAR DistinctTableSum =
ADDCOLUMNS (
VALUES ( ExampleTable[ID] ),
"@SumColumn", CALCULATE (SUMX ( VALUES ( ExampleTable[Value] ), ExampleTable[Value] ) )
)
VAR Result =
AVERAGEX (
DistinctTableSum,
[@SumColumn]
)
RETURN Result
Thanks Ben, It do help a lot. Finally I also figured it out. This is my formula for your reference. Please feel free to give me some advice
Glad you've got it working!
Have a read of: https://www.sqlbi.com/articles/all-the-secrets-of-summarize/
They strongly advise using addcolumns in conjunction with summarise.
Relly appreciate
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!