cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Noexicaise
Frequent Visitor

Count Text Occurence

Hello,

 

I'm trying to get the top 10 occurrences of a column (see below)

 

Table 


The format is text.


Ideally, I would like to get the following result:

 

Result 

 

In this example, Laptop = "5242"  and Windows User Profile = "5003"

 

Thx in advance

 

Regards

 

Julien

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft v-lionel-msft
Microsoft

Re: Count Text Occurence

Hi @Noexicaise ,

 

For your issue, maybe you can do like this:

//create a column in the original table; the Sales[Brand]field is the counted column
Number = 
CALCULATE(
    COUNT(Sales[Brand]),
    ALLEXCEPT(
        Sales, Sales[Brand]
    )
) 
// return the count table
Count_occurence = 
TOPN(
    10,
    DISTINCT(Sales),
    Sales[Number],
    ASC
) 

 

Best Regards,

Lionel Chen

 

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
Zuppke
Regular Visitor

Re: Count Text Occurence

Do you have a table with columns showing you which number goes with what name? Like:

 

NameNumber
Laptop5242

 

If so, you can use a table visual adding 2 columns, one column shows you the "Name" and the other column shows you "Count of Name". You might have to add some relationships if you have more than 1 table.

Highlighted
Microsoft v-lionel-msft
Microsoft

Re: Count Text Occurence

Hi @Noexicaise ,

 

For your issue, maybe you can do like this:

//create a column in the original table; the Sales[Brand]field is the counted column
Number = 
CALCULATE(
    COUNT(Sales[Brand]),
    ALLEXCEPT(
        Sales, Sales[Brand]
    )
) 
// return the count table
Count_occurence = 
TOPN(
    10,
    DISTINCT(Sales),
    Sales[Number],
    ASC
) 

 

Best Regards,

Lionel Chen

 

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

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors