cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Count multiple strings in a column

Hello,
I have a column which can have multiple users; it looks like:

              Column1
Row 1: UserA
Row 2: UserB
Row 3: UserB, UserC, UserG, UserZ
Row 4: User D,
Row 5: UserA, UserD, UserG
Row 6: UserD, UserF

As we see, UserD appeared in the column 3 times, UserA appeared 2 times etc. How to pull out every user from the column to make a visual which says how many times each user appeared in the column?

Thank you for your time!

Regards,
Wojciech

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Count multiple strings in one column

Hello @pal95 ,

You will need to split your column into multiple columns in the query editor as shown in this blog:

https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/

You can then count the occurrences of a string in multiple columns that reference the following existing thread:

https://community.powerbi.com/t5/Desktop/Count-instances-of-string-in-multiple-columns/td-p/239302

Thank you

Pragati





If this helps, Appreciate a KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




View solution in original post

Highlighted
Super User III
Super User III

Re: Count multiple strings in one column

@pal95

in the pq, split column

1.PNG

then group by

2.PNG3.PNG

Did I answer your question? Mark my post as a solution.Appreciate your Kudos!
Proud a to be a Datanaut!
Thanks and BR
Ryan

View solution in original post

4 REPLIES 4
Highlighted
Super User IX
Super User IX

Re: Count multiple strings in a column

@pal95 , see split by row/column in power Query.edit query can help

https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Super User IV
Super User IV

Re: Count multiple strings in one column

Hello @pal95 ,

You will need to split your column into multiple columns in the query editor as shown in this blog:

https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/

You can then count the occurrences of a string in multiple columns that reference the following existing thread:

https://community.powerbi.com/t5/Desktop/Count-instances-of-string-in-multiple-columns/td-p/239302

Thank you

Pragati





If this helps, Appreciate a KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




View solution in original post

Highlighted
Super User III
Super User III

Re: Count multiple strings in one column

@pal95

in the pq, split column

1.PNG

then group by

2.PNG3.PNG

Did I answer your question? Mark my post as a solution.Appreciate your Kudos!
Proud a to be a Datanaut!
Thanks and BR
Ryan

View solution in original post

Highlighted
Community Support
Community Support

Re: Count multiple strings in a column

Hi @pal95,

You can try to use following calculate table formulae to analysis raw table and generated the summarize user tables based on each item and their count:

Summary = 
VAR merge =
    SUBSTITUTE (
        CONCATENATEX ( ALL ( 'Table'[Column1] ), [Column1], "," ),
        " ",
        ""
    )
VAR _path =
    SUBSTITUTE ( merge, ",", "|" )
VAR list =
    ADDCOLUMNS (
        GENERATESERIES ( 1, PATHLENGTH ( _path ), 1 ),
        "Users", PATHITEM ( _path, [Value] )
    )
RETURN
    FILTER (
        GROUPBY ( list, [Users], "Count", COUNTX ( CURRENTGROUP (), [Users] ) ),
        [Users] <> BLANK ()
    )

1.png

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Don't miss the Power BI Dev Camp this week!

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Kudoed Authors