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
joe100
Frequent Visitor

Counting Number of Elements in Array

Having two columns: 

NUMBERID
ABC0157530001612224-25-1,0001612224-25-2,0001612224-25-3,0001612224-25-4
ABC015761EBC257D 85C16327 599F8358  CC990AEF  64CD90C5
ABC01578756567ZXC; 687687687BV; 8787687CVX

 

I wish to add a new column where will be presented number of element from column "ID".

The delimiters can be "," , " " , ";".

 

What's the best way to do this?

 

1 ACCEPTED SOLUTION

Hi, @joe100 

 

You can create a custom column in pq.

Like this:

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

If you need to add newlines, you can use ‘#lf’:

vjaneygmsft_0-1644312563857.png

Did I answer your question? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.

Best Regards,
Community Support Team _ Janey

View solution in original post

5 REPLIES 5
joe100
Frequent Visitor

I think that the solution could be much easier , to count number of delimiters within the string + 1.

How I do it?

Hi, @joe100 

 

You can create a custom column in pq.

Like this:

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

If you need to add newlines, you can use ‘#lf’:

vjaneygmsft_0-1644312563857.png

Did I answer your question? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.

Best Regards,
Community Support Team _ Janey

Sure, thank you!

ValtteriN
Super User
Super User

Hi,

You can split columns by delimiter in powerquery by right clicking a column, but this won't let you to split by multiple delimiters. Chek this post on how to do this: https://community.powerbi.com/t5/Desktop/splitting-multiple-delimiter-in-column-amp-find-max/m-p/222...





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

Proud to be a Super User!




amitchandak
Super User
Super User

@joe100 , I think you need split by a delimiter in power query, more than one (Into rows)

Split Column Power Query: https://youtu.be/FyO9Vmhcfag

 

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

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.