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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Miguelgm28
Frequent Visitor

Display the count of occurrence of text separated by a semicolon in a column

Hello everyone,

 

I had conducted a questionnaire and received data very similar to the below situation: 

 

powerbiquery1.jpg

 

I wish to get a form of visual that shows the count of each element individually, but when I am trying I am getting the below visual.

powerbiquery2.jpg

 

 

The aim is to try go for the following visual which shows each element seperately and not like the above visual which has all the elements together.

powerbiquery3.jpg

 

Would appreciate any assistance with this,

Thanking you in advance!

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Miguelgm28 

It will be easy to count when you have a Responsible Organization Table full of organization names.

You just need to create a measure

 

count =
VAR _name =
    MAX ( 'Responsible Organization Table'[name] )
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' ),
        CONTAINSSTRING ( 'Table'[Responsible organization], _name )
)

 

Then, you will get:

v-xiaotang_0-1619697163920.png

 

Hope it helps.

 

Best Regards,

Community Support Team _ Tang

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

9 REPLIES 9
v-xiaotang
Community Support
Community Support

Hi @Miguelgm28 

It will be easy to count when you have a Responsible Organization Table full of organization names.

You just need to create a measure

 

count =
VAR _name =
    MAX ( 'Responsible Organization Table'[name] )
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' ),
        CONTAINSSTRING ( 'Table'[Responsible organization], _name )
)

 

Then, you will get:

v-xiaotang_0-1619697163920.png

 

Hope it helps.

 

Best Regards,

Community Support Team _ Tang

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

Miguelgm28
Frequent Visitor

Hi @selimovd 

 

Just to confirm you are saying that first I would need to split the data within the column in Power Query by semicolan and then after unpivot to create multiple rows?

 

Wouldn't this make the system think that each new additional row is a new entry to the questionnaire?

 

Thank you once again,

Miguel

selimovd
Super User
Super User

Hey @Miguelgm28 ,

 

split the data in Power Query by comma and then group it by the values.

This should give you the result.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Thanks @selimovd for your response so I split the data in Power Query by semicolan and now I got 8 additional columns.

 

Could you further assist me please? I got stuck with "group it by the values" you previously mentioned, did not fully understand what you meant by this.

 

Thank you,

Miguel

Hi,

In the Split window, click on Advanced and select Split by rows.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur

 

I am definitely missing something here I have a similar problem but with 6 columns with questionnaire responses split by semi-colons.
I have split each column by that delimeter and selected rows in the advanced option but this creates many duplicates of responses I don't want (1500+) rows - is there a group by step or something else I've missed? 

Thank you! 

Hi,

Share some data in a format that can be pasted in an MS Excel file and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hey @Miguelgm28 ,

 

sorry, I was also not precise. You should unpivot the columns after splitting them, then you have a new row for each item.

Check the following Power Query example:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8i9Kd7QGEk4gwlkpVgcsBGegCYN4jjAekBELAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Organization = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Organization", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Organization", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"Organization.1", "Organization.2", "Organization.3"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Organization.1", type text}, {"Organization.2", type text}, {"Organization.3", type text}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type1", {}, "Attribute", "Value")
in
    #"Unpivoted Columns"

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Hi, I am going through the same thing - what will happen when additional options are added onto the columns e.g. Service 1: now had service 1, service 2, service 3?

Would this be added onto the column after unpivot step as been applied?

Hope that makes sense.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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