Forum Discussion
Distinct count rows that are not blank!
- Anonymous9 years ago
=calculate( distinctcount(MyTable[MyColumn]), MyTable[MyColumn] <> BLANK())
=calculate( distinctcount(MyTable[MyColumn]), MyTable[MyColumn] <> BLANK())
- XMonsterX9 years agoAdvocate II
Good solution...
One issue.. It if you have duplicate values it counts it as one. For example, if my table column is what people chose as a favorite animal, it would have a lot of people choosing dogs. There would be for example 50 dogs, but this formula would count the 50 instances of "Dog" as one. (Just a simple example). If there's 50, you want the count to reflect that.
MeasureHappy = calculate(count(MyTable[MyColumn]), MyTable[MyColumn] <> BLANK())
Changing from distinctcount, to just plainly count will resolve this, for anyone not looking to count dups as a singular. (If you want a zero instead of null
MeasureHappy = calculate(count(MyTable[MyColumn]), MyTable[MyColumn] <> BLANK()) + 0
Happy Intellegence
David
- Anonymous9 years agoNot applicable
Thanks a lot!!! :)
- Anonymous9 years agoNot applicable
Hey Anonymous
If the distinctcount of a column is equal to zero then distinctcount returns BLANK(null). Can I fix this to show 0 instead of null?
- Oxenskiold9 years agoAdvocate I
Hi Anonymous,
you can use this:
=
CALCULATE ( DISTINCTCOUNT ( MyTable[MyColumn] ), MyTable[MyColumn] <> BLANK () ) + 0<Blank> + 0 equals 0
Kind regards
Oxenskiold
- Anonymous9 years agoNot applicable
Thanks Oxenskiold! :))
- fahadfarooqi9 years agoFrequent Visitor
- bajimmy19837 years agoAdvocate V
Excellent Anonymous. Thanks a lot!