Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Count similar strings within a query (example input and output in description)

Hey everyone, I'm looking for help creating a DAX equation to find the same value over a given power query and count the amount of times it appears.

 

Any ideas or ways to go about this.

 

The image attached shows an example of a given table and what the desired result is.

 

Any advice or ideas are welcome.

 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Go to the power query and select all three columns – Unpivot Columns.

    Result:

    2. Select the matrix Visual, and place the column [Value] into Rows and Values respectively

    And in the Values column, set it to Count..

    3. Result:

     

    Best Regards,

    Liu Yang

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

  • Anonymous's avatar
    Anonymous
    4 years ago

    Thank you for the help on this. Your method didn't fully solve it the way I needed it however with the unpivoted columns I was able to GROUP the similar texts and sum the quantity value on the same row.

     

    Example:

     

3 Replies

  • daXtreme's avatar
    daXtreme
    Icon for Solution Sage rankSolution Sage

    Input data is not in a format suitable for Power BI. Please unpivot the table first using Power Query so that the columns' names become a column themselves. Then the task will be as easy as a, b, c... Your measure will be simple as well: countrows( T ).

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Go to the power query and select all three columns – Unpivot Columns.

    Result:

    2. Select the matrix Visual, and place the column [Value] into Rows and Values respectively

    And in the Values column, set it to Count..

    3. Result:

     

    Best Regards,

    Liu Yang

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you for the help on this. Your method didn't fully solve it the way I needed it however with the unpivoted columns I was able to GROUP the similar texts and sum the quantity value on the same row.

       

      Example: