Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I have two columns where I want to find data and then count the number of rows found.
| SW | PR |
| SW | SW |
| PR | SS |
| TR | TR |
In the table above how can I count the number of rows where SW appears? Result expected would be 2.
I was trying to use the following, but successful.
Thanks
Solved! Go to Solution.
In that case, you can use the following:
Count SW Rows =
COUNTROWS (
FILTER (
SearchTable,
SEARCH (
"SW",
SearchTable[Column1],
,
0
) > 0
|| SEARCH (
"SW",
SearchTable[Column2],
,
0
) > 0
)
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi @Anonymous ,
Please let us know if the latest reply of @mahoneypat could meet your requirements.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Please try this measure to get the rows with SW in them. Replace SearchTable with your actual table name.
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thanks. It does work.
I forgot to mention that sometimes is not explicitly written SW, but ASW or BSW. I've tried to use wildcards "*SW*" but it did not produce any result.
In that case, you can use the following:
Count SW Rows =
COUNTROWS (
FILTER (
SearchTable,
SEARCH (
"SW",
SearchTable[Column1],
,
0
) > 0
|| SEARCH (
"SW",
SearchTable[Column2],
,
0
) > 0
)
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi @Anonymous
Count SW covered = CALCULATE(COUNTROWS('Table1'),SEARCH("SW",[Col1]) > 0 || SEARCH("SW",[Col2]) > 0)
Hello,
It does not work. Throws this error
The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 94 | |
| 70 | |
| 50 | |
| 40 | |
| 39 |