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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Filtering out '0' in two columns to bring back results only with a numbers

 Hi

I'm trying write a measure to get results back from a table (looking at two columns) which counts only the results which have a number in one or both columns , ignoring anything with '0' in both columns. If I was using excel I would filter out the two columns which have '0' in both cells, leaving me with the columns that have a number in both, or a number in one and '0' in the other. I do not want to include results that have a zero in both columns only. The measure I have written is

= COUNTROWS(FILTER('Cycle Counts','Cycle Counts'[Cycle Count Qty. (Calculated)]<>0) & COUNTROWS(FILTER('Cycle Counts','Cycle Counts'[Cycle Count Qty. (Phys. Inventory)]<>0)))
I get an error back to say the parameter is not correct and also that'multiple columns cannot be to a scalar value.
I am very new to this hence the multiple errors and have zero practice at writing measures
1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure out.

 

= COUNTROWS(FILTER('Cycle Counts','Cycle Counts'[Cycle Count Qty. (Calculated)]<>0 && 'Cycle Counts'[Cycle Count Qty. (Phys. Inventory)]<>0))

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

5 REPLIES 5
FabricLearnFabr
Regular Visitor

How do you use this measure to filter out the data?

 

mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure out.

 

= COUNTROWS(FILTER('Cycle Counts','Cycle Counts'[Cycle Count Qty. (Calculated)]<>0 && 'Cycle Counts'[Cycle Count Qty. (Phys. Inventory)]<>0))

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi Pat

 

Many thanks, this one worked!

camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Try it using COUNTX:

https://docs.microsoft.com/pt-br/dax/countx-function-dax



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Hi- unfortunately I don't know if. this would have worked as the link looked like it was in Spanish. I did get a solution though, and thank you for replying.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.