Forum Discussion

annetoal's avatar
annetoal
Helper II
5 years ago
Solved

Counting words in a column

A table contains a column with 7188 rows. Each row contains a short phrase or a single word. I want to go through row by row and see how many times a phrase appeared. Like how many times did "house cat" appear, how many times did "fat cat" appear.

 

I have created a column with this formula:

WordCount = COUNTA(TableName[ColumnName])
Then I use the Matrix control putting the column contents in the Rows and the WordCount in the Values.

 

For reasons I don't get, any phrase that just appears once, shows up in the Matrix with a count of 7188. Can someone please help me get this right? 

 

Thanks,

Anne

  • If you use the key phrase column as your row headers in a matrix and create the below measure

     

    Key Phrase Count =
    CALCULATE( COUNTROWS( PhraseTable))
     
    Put the measure in your matrix and that should be good.
  • Anonymous's avatar
    Anonymous
    5 years ago

    I don't know if it is possible also in DAX, but using only a function in PQ,

     

     

    starting from this data table

     

    you can get this result:

     

18 Replies

  • annetoal 

    Are you looking for a Power Query or  DAX solution?

    ________________________

    If my answer was helpful, please consider Accept it as the solution to help the other members find it

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube  LinkedIn

    • annetoal's avatar
      annetoal
      Helper II

      I would prefer DAX if possible. However from reading some of the things on the net I see a lot of people recommending PowerQuery. I am a complete novice at PowerQuery, and slightly less of a novice at DAX. Please, if you could provide a basic solution that a noob can handle, I would be very appreciative.

       

      Anne

      • Anonymous's avatar
        Anonymous
        Not applicable

        I don't know if it is possible also in DAX, but using only a function in PQ,

         

         

        starting from this data table

         

        you can get this result: