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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! 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
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.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.