Forum Discussion
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
- Syndicate_AdminAdministrator
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.
- Syndicate_AdminAdministrator
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")) - Syndicate_AdminAdministrator
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.
- Syndicate_AdminAdministrator
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.
- Syndicate_AdminAdministrator
I hope this will be useful to you. Good luck! 🙂