Forum Discussion
tcmem
8 years agoRegular Visitor
How to include Zeros in column value count
I'm trying to calculate a count of items in a column that are less than or equal to 12. For some reason, it's excluding the Zeros. How do I include the Zeros in my count? I'm also excluding blanks ba...
- 8 years ago
Hi, you can use:
Measure = COUNTROWS ( FILTER ( Table1, ISBLANK ( Table1[Field2] ) = FALSE () && Table1[Field2] <= 12 ) )Measure = CALCULATE ( COUNT ( Table1[Field2] ), FILTER ( Table1; ISBLANK ( Table1[Field2] ) = FALSE () && Table1[Field2] <= 12 ) )Regards
Victor
Lima - Peru
tcmem
8 years agoRegular Visitor
Here's an example of my data:
| Field1 | Field2 |
| Acct1 | 13 |
| Acct2 | |
| Acct3 | 1 |
| Acct4 | 5 |
| Acct5 | |
| Acct6 | 3 |
| Acct7 | 0 |
| Acct8 | 12 |
Based on my criteria of counting Field1 where Field2 is <= 12 and NOT BLANK, the results should be a count of 5.
Vvelarde
Community Champion
8 years ago
Hi, you can use:
Measure =
COUNTROWS (
FILTER ( Table1, ISBLANK ( Table1[Field2] ) = FALSE () && Table1[Field2] <= 12 )
)
Measure =
CALCULATE (
COUNT ( Table1[Field2] ),
FILTER ( Table1; ISBLANK ( Table1[Field2] ) = FALSE () && Table1[Field2] <= 12 )
)
Regards
Victor
Lima - Peru
- tcmem8 years agoRegular Visitor
Hello Victor,
I used the second suggestion and it worked perfectly. :-) Thank you so much for your help!
Measure =
CALCULATE (
COUNT ( Table1[Field2] ),
FILTER ( Table1, ISBLANK ( Table1[Field2] ) = FALSE () && Table1[Field2] <= 12 )
)