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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Power Query - Count and Sum excluding Specific Value

Hello,

 

I am trying to do two things within power query:

1. For each row, determine how many from Count1, Count2, and Count3 has a value excluding the value 6

2. For each row, sum Count1, Count2, and Count3 but excluding the value 6

 

Example:

Row ABC:

1. 3 (all 3 Count columns have a value that is not 6)

2. Sum is 6 (2+2+2)

 

Row DEF:

1. 2 (Count2 and Count3 are included, but Count1 is excluded because it is a 6)

2. Sum is 1 (0+1)

 

Image.JPG

 

If needed, I could replace 6 with null, but I was still having trouble figuring out ask #1

 

Any assistance would be appreciated.

 

Thank you,

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Assume these are columns and you need a new column in the power query

 

Count =

List.Count(List.Select({[Count1],[Count2],[Count3]}, each _ <> 6 ))

 

 

Sum =

List.Sum(List.Select({[Count1],[Count2],[Count3]}, each _ <> 6 ))

 

 

Power Query- List.Select: https://youtu.be/WYi_3IlhccM

 

Power Query- List.Sum. Sum of a column in Power Query: https://youtu.be/Mud1RSqW5pw

 

Power Query - List.Count and List.Distinct: https://youtu.be/zNREVnoAHwM

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Assume these are columns and you need a new column in the power query

 

Count =

List.Count(List.Select({[Count1],[Count2],[Count3]}, each _ <> 6 ))

 

 

Sum =

List.Sum(List.Select({[Count1],[Count2],[Count3]}, each _ <> 6 ))

 

 

Power Query- List.Select: https://youtu.be/WYi_3IlhccM

 

Power Query- List.Sum. Sum of a column in Power Query: https://youtu.be/Mud1RSqW5pw

 

Power Query - List.Count and List.Distinct: https://youtu.be/zNREVnoAHwM

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thank you for the solution and providing some links for me to get more information.

 

Still trying to get use to all the possible functions.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.