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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
marchn
Helper I
Helper I

SUM attendees with duplicate values

Hello all

 

I have been so grateful for the support I've received from this forum since I embarkd on my Power BI journey a month or two ago. I've learned so much, but still SO much to learn. I would be very grateful if someone could help me. 

 

I have duplicate data in numerous sources in my query, which is necessary because I have records from a Microsoft list where users can select multiple values in a number of different fields. Therefore, I have no option but to expand the data. And this has worked well until I hit a brick wall with this issue. 

 

I have a source which allows users to record details of engagement activity, the organisation(s) involved, the project(s) discussed and the number of attendees at a given engagement. As per the dummy data below:

 

IDTitleFormatOrganisationsProject(s)Attendees
1SupermanEmailMickey Mouse Club House
Donald Duck inc
Comedy
Romance
4
2Wonder WomanWebinarTom Ltd
Jerry Ltd
Tweetie Pie and Co
Horror
Comedy
2
3BatmanEmailDaffy Duck PiesDocumentary2
4Iron ManPhonecallGoofy HQHorror
Thriller
1
5WolverineEmailPluto Dog House
Popeye Sailors and Son
Horror
Thriller
5
6The HulkWebinarMonsters Inc
Mike R Scare Factory
Comedy
Romance
Thriller
18
    TOTAL32

 

However, when I expanded the data in the query, I had the issue of the attendee numbers repeating. No problem, I did "grouped by", then calculated the number of repeating IDs and created a new column to show Average number of attendees per row = Attendees / number of occurences of each ID - as per the below. This solves the problem of the TOTAL numer of attendees. 

 

IDTitleFormatOrganisationsProject(s)AttendeesAverage Attendees
1SupermanEmailMickey Mouse Club HouseComedy41
1SupermanEmailMickey Mouse Club HouseRomance41
1SupermanEmailDonald Duck incComedy41
1SupermanEmailDonald Duck incRomance41
2Wonder WomanWebinarTom LtdHorror20.333333333
2Wonder WomanWebinarTom LtdComedy20.333333333
2Wonder WomanWebinarJerry LtdHorror20.333333333
2Wonder WomanWebinarJerry LtdComedy20.333333333
2Wonder WomanWebinarTweetie Pie and CoHorror20.333333333
2Wonder WomanWebinarTweetie Pie and CoComedy20.333333333
3BatmanEmailDaffy Duck PiesDocumentary22
4Iron ManPhonecallGoofy HQHorror10.5
4Iron ManPhonecallGoofy HQThriller10.5
5WolverineEmailPluto Dog HouseHorror51.25
5WolverineEmailPluto Dog HouseThriller51.25
5WolverineEmailPopeye Sailors and SonHorror51.25
5WolverineEmailPopeye Sailors and SonThriller51.25
6The HulkWebinarMonsters IncComedy183
6The HulkWebinarMonsters IncRomance183
6The HulkWebinarMonsters IncThriller183
6The HulkWebinarMike R Scare FactoryComedy183
6The HulkWebinarMike R Scare FactoryRomance183
6The HulkWebinarMike R Scare FactoryThriller183
    TOTAL16032

 

However, I'm now at the stage where I need to create visuals based on total number of attendees involved in a given project. This means that the Total is incorrect, but so is the average. As per the below where I have selected just Comedy:

 

IDTitleFormatOrganisationsProject(s)AttendeesAverage Attendees
1SupermanEmailMickey Mouse Club HouseComedy41
1SupermanEmailDonald Duck incComedy41
2Wonder WomanWebinarTom LtdComedy20.333333333
2Wonder WomanWebinarJerry LtdComedy20.333333333
2Wonder WomanWebinarTweetie Pie and CoComedy20.333333333
6The HulkWebinarMonsters IncComedy183
6The HulkWebinarMike R Scare FactoryComedy183
    TOTAL509

 

The actual number of attendees involved in the Comedy project is 24 - I.e the sum of attendees based on distinct IDs. If I take ID 1 for instance - there were 4 attendees involved in comedy for ID 1, because all 4 attendees did both. However, the average would assume it was only 2. The total would assume it was 16. Can anyone help me to resolve this? I would be very grateful. I've tried lots of things with SUMX to sum distinct values, but everything I've tried doesn't work. 

 

 

1 ACCEPTED SOLUTION
audreygerred
Super User
Super User

Hello - instead of creating the average column, create the below measure:

Total Attendees = SUMX(DISTINCT(Table[ID]),FIRSTNONBLANK(Table[Attendees], 0))
 
I get the below:
audreygerred_0-1698938985936.pngaudreygerred_1-1698939080204.png

 

Hope this helps! Have a great day!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
audreygerred
Super User
Super User

You're very welcome! Happy to help!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





marchn
Helper I
Helper I

Hello audreygerred - thank you so much! That works perfectly! Really grateful. Natasha

audreygerred
Super User
Super User

Hello - instead of creating the average column, create the below measure:

Total Attendees = SUMX(DISTINCT(Table[ID]),FIRSTNONBLANK(Table[Attendees], 0))
 
I get the below:
audreygerred_0-1698938985936.pngaudreygerred_1-1698939080204.png

 

Hope this helps! Have a great day!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.