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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PKidd
Frequent Visitor

Sum only once when multiple selection contained in csv column value

I have a table of schools and attendance figures

The school names are in  in CSV format
I would like to sum the attendance figures only once per selected school

The school selection is dynamic and multiple selection .

I have been trying to do something with filter and contains but not having much luck.

Any suggestions welcome

 

PKidd_0-1665351822370.png

A,B= 60

A,C= 47

 

1 ACCEPTED SOLUTION

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
PKidd
Frequent Visitor

Raw data for sessons data

SessionSchoolsPupils
1A10
2A,B11
3A,B,C12
4B13
5A,C14

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish

Unfortunately your down load is blocked for me i wonder if you could paste in some of your workings, that would be great to see.

Thanks

Hi,

File attached. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
PKidd
Frequent Visitor

With the data above the sum total should be the following when school or schools are selected:

A47
B36
C26
A,B60
A,C47
A,B,C60
B,C50

 

The problem with a straight sum by split schools is that the numbers will be counted twice or more depending on the number of schools selected - when we only want something like the Excel text filter contains when
sum(
    [sessions.pupils],
    sessions.[schools](contains(schools.selected) = true),   
)

Hi,

Share raw data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

You should split the Schools column into multiple rows (in the Query Editor).  Drag this measure to your visual

Measure = sum(Data[Pupils])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Shaurya
Memorable Member
Memorable Member

Hi @PKidd,

 

Can you please share some sample? The table in your visual doesn't seem to make sense. If A alone is 10 and B is 13, then A,B should not be 11.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors