Skip to main content
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

New Member

Count columns if they fit with any condition ( countif )

Hi dear Community,

In Power BI (Desktop)

I have 20 columns with numbers and and I need to count them if they match with a value (i.e. count if the column's value = 0) 

 I need to create a new column with this count

Any advice how I can calculate it, since the countif function (for columns) does not exist in Power Bi


I appreciate your help

Carlos G.


Community Champion
Community Champion



With Query Editor, We can add a custom Column like


List.Count(List.Select(Record.ToList(_),each _ =0))


Please try my custom visuals

Thanks a lot for your help..

It worked, but I would like to understand it better.

Could you try to explain it in a few words?...pleaseee... I appreciate it


Thanks a lot

Carlos G.


Hi Zubair, 

Actually, I would like to know how I can specify a contigous range of columns in order to apply this "count if"...

How I can do it?

Below the 3 columns that I need to apply this "Count If"



HI @CarlosGonzalezC 

You could use IF Functions in Power Query Including Nested IF for these three columns

For example:

if [Column1]" and [Column2] and [Column3] then <Your expected outrput> else <Your other output>




Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.


Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.


Fabric certifications survey

Certification feedback opportunity for the community.