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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ssspk
Helper I
Helper I

Count number of elements in each column cell (Delimiters) and display the values in the new column?

Hi,

Having a column like below,

Data:

"[""bTravel"",""bTravel Planning"",""travel booking"",""travel planning""]"
[]
"[""engine"",""news"",""search""]"
[]
"[""collaboration"",""connect"",""connections"",""network""]"

Column DataColumn Data

To get the count of the words in each cell using a delimiter comma(,).

Used fx as below for the specific count of keywords,

New Column name is keywords count.

 

= Table.AddColumn(applicationcatalog_Table, "keywords count", each List.NonNullCount(Text.Split([keywords],",")))

 

Result:

Result of CountResult of Count

 

Why its displaying resuit as 1 in cell, instead of 0 as result for []  in the coulun(keywords count) cells.?

Thank you.

 

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @ssspk ,

 

vtangjiemsft_0-1703556921110.png

 

The list after separating by "," is not empty, so the function works as designed, the solution is

You can add another column:

 

 

= Table.AddColumn(#"Added Custom", "Custom", each if [keywords] = "[]" then 0 else if [keywords] <> "[]" then [keywords count] else null)

 

 

Picture2.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

2 REPLIES 2
v-tangjie-msft
Community Support
Community Support

Hi @ssspk ,

 

vtangjiemsft_0-1703556921110.png

 

The list after separating by "," is not empty, so the function works as designed, the solution is

You can add another column:

 

 

= Table.AddColumn(#"Added Custom", "Custom", each if [keywords] = "[]" then 0 else if [keywords] <> "[]" then [keywords count] else null)

 

 

Picture2.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Hi @v-tangjie-msft ,

Thank you for your time and solution. Its working fine.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors