Forum Discussion
count numeric column cells and exclude certain value
- 9 years ago
Yep that's another way of doing the same thing...
the only thing I'll change is add the table name as per Rob Collie's post here
EDIT: Sorry the post was actually by MattAllington on Rob's site
- Column reference: Table[Column Name]
- Measure Reference: [measure name]
But that's just a suggestion it should work regardless :smileyhappy:
Count Column = COUNTX ( FILTER ('Table', 'Table'[Column] <> 0) , 'Table'[Column] )
Hey dlgardo,
Create a new column like the one below:
Count Column = SUMX([Dataset], IF([Column1]<>0, 1, 0))
This will count all the fields that are not equal to 0.
Hope this helps,
Alan
Here's an alternative
Column Count Measure = CALCULATE ( COUNTROWS('Table'), 'Table'[Column] <> 0 )The above is basically internally treated like this...
Column Count Measure = CALCULATE ( COUNTROWS('Table'), FILTER ( 'Table', 'Table'[Column] <> 0 ) )Also if for some reason you neeed to exclude the zeros but include the blanks just add the countblank like this
Column Count Measure = CALCULATE ( COUNTROWS('Table'), 'Table'[Column] <> 0 ) + COUNTBLANK ( 'Table'[Column] )
- alanhodgson9 years ago
Solution Supplier
Hey dlgardo,
Sean's answer works for me. This also seems to work:
Count Column = COUNTX(FILTER('Table', 'Table'['Column'] <> 0),[Column])Sean can you confirm?
Thanks,
Alan
- Sean9 years ago
Community Champion
Yep that's another way of doing the same thing...
the only thing I'll change is add the table name as per Rob Collie's post here
EDIT: Sorry the post was actually by MattAllington on Rob's site
- Column reference: Table[Column Name]
- Measure Reference: [measure name]
But that's just a suggestion it should work regardless :smileyhappy:
Count Column = COUNTX ( FILTER ('Table', 'Table'[Column] <> 0) , 'Table'[Column] )