Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

SUM Column but Average Values Based on Duplicates in Another Column

AB
0.104945708906
0.864945708908
0.174945708909
0.296041671331
0.226041671331
1.516041671334
1.676041671334
0.226041671337

 

I would like to sum the values in column A, but if there are duplicates in column B, I want to average the values of the duplicates then include that average in the sum.

 

So instead of adding 0.29 and 0.22 as part of the sum of column A, first gather their average = .255 and use that in the total sum instead. Then do the same for 1.51 and 1.67, etc.

1 ACCEPTED SOLUTION
jthomson
Solution Sage
Solution Sage

Should be easy enough with an intermediate summary table, something like:

 

summarize(yourtablename,[column b],"column a averaged",average([column a])

 

You can then sum up your new "column a averaged" column

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

ABC
0.1494570890630
0.864945708908150
0.174945708909 0
0.29604167133190
0.22604167133160
1.516041671334200
1.676041671334220
0.226041671337 0

 

Both solutions work, but what if I have additional columns that I want to SUM

 

Also this is all being done in a UNION(SELECTCOLUMNS( and if possible would like it achieved under "A"

    SELECTCOLUMNS (
        'Table1',
	"A", 'Table1'[A],
        "D", 'Table1'[D],
        "E", 'Table1'[E],
        "C", 'Table1'[C]/60),

 but maybe thats not feasible, or am setting this up wrong.

 

 

Nevermind, the Summarize expression works, I just have to keep adding to it and rebuild my table.

Ruksuro
Helper III
Helper III

I like to use:

 

Average Measure = AVERAGEX(Sheet2,Sheet2[A])

 

Then

 

Sum Average Measure by B = sumx( DISTINCT(Sheet2[B]), [Average Measure])

jthomson
Solution Sage
Solution Sage

Should be easy enough with an intermediate summary table, something like:

 

summarize(yourtablename,[column b],"column a averaged",average([column a])

 

You can then sum up your new "column a averaged" column

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.