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
cibgks
Regular Visitor

Count several factors of variable without duplicating ID

Hello everyone,

 

I am facing the following problem for a couple of weeks and I couldn't find a solution yet. Any help will be appreciated.

 

To clarify the problem, suppose I have this table:

 

ID                       |           SOURCE

1                        |                s1

2                        |                s2

3                        |              s1,s2

 

I want to show this result in the dashboard

 

SOURCE            |            COUNT

s1                      |                2

s2                      |                2

 

without duplicating the third row of my dataframe.

 

How can I do that?

Thanks in advance

3 REPLIES 3
Anonymous
Not applicable

@cibgks,

The method that I can think of is to split columns in your table and then create a table visual as shown in the following screenshot.

1.PNG2.PNG

Regards,
Lydia

Hi Lydia, thanks for your time and answer.

 

That solution could work, but I should not be duplicating IDs because other variables would be duplicated (for example Amount).

 

I found a way to solve the problem, but it is taking too much time to refresh in a small dataset (60k rows). Any ideas how to optimize this M code?

 

#"test" = Table.AddColumn(#"changed", "counter", (countFunction) =>
List.Sum(Table.TransformRows(#"previoustable", each if Text.Contains(_[source1], countFunction[Source])  then 1 else 0 )))

 

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