Forum

Notifications
Clear all

CountIF

3 Posts
2 Users
0 Reactions
137 Views
(@carthyeilygmail-com)
Posts: 20
Eminent Member
Topic starter
 

I have created the score results from a large file in Power Query. Is it possible to use a CountIf in Power Query, rather than doing in the finished excel table?

 
Posted : 27/12/2023 12:29 pm
Riny van Eekelen
(@riny)
Posts: 1218
Member Moderator
 

Since you only have three columns to work with, consider to keep it simple and add a custom column with the following code:

= Number.From([MR Score]>0) + Number.From([EI Score]>0) + Number.From([FR Score]>0)
 
If, on the other hand you real data contains more columns to check for non-zeros a more dynamic code may be useful.
 
= List.Count( List.RemoveMatchingItems (Record.FieldValues(_), {0} ) ) -1
 
This creates a list of values for each row, removes the zeros, counts the number of items in the list and deducts 1 for the Account value that is part of the list but should not be counted.
 
Posted : 28/12/2023 3:44 am
(@carthyeilygmail-com)
Posts: 20
Eminent Member
Topic starter
 

Thanks that worked.

 
Posted : 29/12/2023 4:58 am
Share: