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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
cjl2144
New Member

Power Query - count columns with specific values

Is there a way to implement a "COUNTIF" Excel function in Power Query for a custom column? Preferably without having to write formulas to check the value of each column individually?

 

For example, for each row, I'd like a count of the number of columns that have a specific value (value = 6). See screenshot below from Excel, with the desired result in column J and formula in column K.

 

The only way I've found so far is to do something like this, but this becomes cumbersome if dealing with many columns (100+).

Any help is appreciated!

4 REPLIES 4
hnguy71
Super User
Super User

My suggestion is to begin by using UNPIVOT OTHER COLUMNS, then use GROUPBY, then do a COUNT for your specific value



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Thanks for the suggestion. Where can you implement a COUNT for a specific value? All of the options I am able to find only do a count of the number of rows. 

 

PowerBIGroupBy.PNGPowerBIStatistics.PNG

It should already count for you.

 

Here's my example:

countif.png



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Select the Nodes columns >> Unpivot Columns >> Filter Values = 6 >> Group by Date and Node and count the rows.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.