cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

To count the splitted column

Hi All,

I have splitted the string to multiple columns by Edit Query option. I just want to get count of column that has value.

See below example of table splitting.

2017-06-26 15_23_45-KPI April - Power BI Desktop.jpg

 

Can someone help on this?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User III
Super User III

Re: To count the splitted column

Agree with @Anonymous, but if his suggestion is not option, a new column with this formula would do the trick:

List.NonNullCount(Record.FieldValues(_))

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

Highlighted
Community Support
Community Support

Re: To count the splitted column

Hi @arjunsk,

 

I agree with pawelpo's point of view, you can add a column to store the count of list which split your cell text with particular separator.

 

For example:

    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Count Item", each List.Count(Text.Split([Column],",")))

`.PNG2.PNG

 

 

Reference:

 

Function Description
List.Count Returns the number of items in a list.
Text.Split Returns a list containing parts of a text value that are delimited by a separator text value.

 

 

Regards,

Xiaoxin Sheng

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

View solution in original post

3 REPLIES 3
Highlighted
Anonymous
Not applicable

Re: To count the splitted column

In my opinion, it's not the best idea to split the data into columns when you have multiple items in a single column. Why not split strings into rows? (this option is also available in Power BI Desktop transformations) Then you could perform a simple COUNT for each issue row to find the number of related issues.

Highlighted
Super User III
Super User III

Re: To count the splitted column

Agree with @Anonymous, but if his suggestion is not option, a new column with this formula would do the trick:

List.NonNullCount(Record.FieldValues(_))

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

Highlighted
Community Support
Community Support

Re: To count the splitted column

Hi @arjunsk,

 

I agree with pawelpo's point of view, you can add a column to store the count of list which split your cell text with particular separator.

 

For example:

    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Count Item", each List.Count(Text.Split([Column],",")))

`.PNG2.PNG

 

 

Reference:

 

Function Description
List.Count Returns the number of items in a list.
Text.Split Returns a list containing parts of a text value that are delimited by a separator text value.

 

 

Regards,

Xiaoxin Sheng

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

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors
Top Kudoed Authors