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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Ferdy
New Member

Table Group, text combine with count of occurrence

Hello!

 

I followed these steps to create a table with a concatenated list of values:

https://stackoverflow.com/a/44058791

 

This helped me a lot, but I need to take it one step further.

 

My current table is now like this:

 

Aapple, apple
Bapple, pear, pear
Cpear, orange, orange, orange
D

apple, apple, orange, orange

Epear

 

But I'd like to show it like this:

A2 x apple
B1 x apple, 2 x pear
C1 x pear, 3 x orange
D2 x apple, 2 x orange
E1 x pear

 

Can anyone help me to achieve this?

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

You can use this formula in a custom column.  Column2 is the column with the text list.

 

= let
mylist = Text.Split([Column2],",")
in
Text.Combine(List.Transform(List.Distinct(mylist), each Number.ToText(List.Count(mylist) - List.Count(List.RemoveItems(mylist, {_}))) &"X " & _), ", ")


Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Employee
Employee

You can use this formula in a custom column.  Column2 is the column with the text list.

 

= let
mylist = Text.Split([Column2],",")
in
Text.Combine(List.Transform(List.Distinct(mylist), each Number.ToText(List.Count(mylist) - List.Count(List.RemoveItems(mylist, {_}))) &"X " & _), ", ")


Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Great thanks!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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
Top Kudoed Authors