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

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
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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.