cancel
Showing results for
Did you mean:
Highlighted
Helper II

## 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?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User V

## Re: Count zero but not blank

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:

Regards

Miguel Félix

Proud to be a Super User!

Check out my blog:

Power BI em Português

3 REPLIES 3
Highlighted
Super User IV

## Re: Count zero but not blank

Try countrows on your fact table. use FILTER to filter the fact table for [Discount] <> BLANK() and then count zeros.

______________

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved.

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query.

excelwithallison.com

Highlighted
Super User V

## Re: Count zero but not blank

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:

Regards

Miguel Félix

Proud to be a Super User!

Check out my blog:

Power BI em Português

Highlighted
Super User IX

## Re: Count zero but not blank

@seryil , Try

CALCULATE([Total Sales], Filter(Sales,not(isblank(Sales[Discount] )) && Sales[Discount] = 0))
or
CALCULATE([Total Sales], coalesce(Sales[Discount],-1) = 0)

Proud to be a Super User!

Announcements

#### Power Platform Community Conference

Check out the on demand sessions that are available now!

#### Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

#### Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021