Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
3 years ago

How to count if

Hello good, sorry anyone knows how I can perform the text count "yes", in a column containing "yes" and "no"?

5 Replies

  • Hello @Keviincr22,

    In Power BI, you can count "yes" text in a column containing "yes" and "no" using the CONTARROWS function and the FILTER function.

  • Here's how:

    1. Create a new measure in the "View" tab of Power BI Desktop by clicking "New Measure" on the ribbon.

    2. Type the following formula in the formula bar:

    Conteo Si = COUNTROWS(FILTER('NombreTabla', 'NombreTabla'[NombreColumna] = "si"))
  • 3. Replace "TableName" with the name of the table containing the column you want to count and "ColumnName" with the name of the column containing "yes" and "no".

    4. Click "OK" to create the measurement.

  • This measure uses the FILTER function to select only the rows in the specified column that contain the text "if". The COUNTROWS function then counts the number of resulting rows, which will give you the "if" text count in that column.