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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
joe100
Frequent Visitor

Count Occurrences of ";" in Cell

Guys, 

 

Please your help to write a DAX expression that gets a value from each row and count delimiters.

 

The delimiter can be ";", " " or ",".

 

Thanks in advance

3 ACCEPTED SOLUTIONS
SanketBhagwat
Solution Sage
Solution Sage

Hi @joe100 .
Not sure about DAX, but you can do it in Power Query.
Just create a custom column using formula as below;

List.Count(Text.ToList(Text.Select([Column], ";")))


Let me know if it works.
Thanks,
Sanket.

If this post helps, then give it a 👍 and mark it as 'Accept as Solution'.

View solution in original post

Just replace the ;  from that formula with "," or " " as per your requirement.

If this post helps, then give it a 👍 and mark it as 'Accept as Solution'.


View solution in original post

CNENFRNL
Community Champion
Community Champion

 

= List.Count(Text.PositionOfAny("abc,def shkd;22l3f oiw;d", {";"," ",","}, 2))

 

CNENFRNL_0-1643796454694.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

5 REPLIES 5
CNENFRNL
Community Champion
Community Champion

 

= List.Count(Text.PositionOfAny("abc,def shkd;22l3f oiw;d", {";"," ",","}, 2))

 

CNENFRNL_0-1643796454694.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

In my case it's:

List.Count(Text.PositionOfAny([ID], {";"," ",","}, 2)))

Awesome! This works for me, many thanks.

Is there an option to add also "NewLine" delimiter?

SanketBhagwat
Solution Sage
Solution Sage

Hi @joe100 .
Not sure about DAX, but you can do it in Power Query.
Just create a custom column using formula as below;

List.Count(Text.ToList(Text.Select([Column], ";")))


Let me know if it works.
Thanks,
Sanket.

If this post helps, then give it a 👍 and mark it as 'Accept as Solution'.

Thank you, it works!

How I extend it also for "," and " "?

Just replace the ;  from that formula with "," or " " as per your requirement.

If this post helps, then give it a 👍 and mark it as 'Accept as Solution'.


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.