Forum Discussion
Anonymous
6 years agoNot applicable
Count zero but not blank
Hi everyone,
I have created a measure where I count all sales that have been sold with 0 discount. But my problem is that it also counts all the blank fields in the specific column. Below is my measure:
Measure = CALCULATE([Total Sales], Sales[Discount] = 0)
When I write 0 then it takes 0 AND blank. How can I count all the 0 from the column "Discount" but not include blank fields?
Hello @seryil ,
You must use the strictly equal sign, so your measure should be:
Measure = CALCULATE([Total Sales], Sales[Discount] == 0)check the explanation at the following link:
3 Replies
- amitchandak
Super User
Anonymous , Try
CALCULATE([Total Sales], Filter(Sales,not(isblank(Sales[Discount] )) && Sales[Discount] = 0))
or
CALCULATE([Total Sales], coalesce(Sales[Discount],-1) = 0) - AllisonKennedy
Community Champion
Try countrows on your fact table. use FILTER to filter the fact table for [Discount] <> BLANK() and then count zeros.