Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
RogerSteinberg
Post Patron
Post Patron

How to show 0 instead of blanks

I would like to calculate various ratios per day.

 

For example, I have a column with possibility of values A, B for each day.

I would like to calculate the ratio of A to totals.

 

Certain days I can have no values of A.

 

When I use the following measure, I will have blanks instead of zeros.

 

DIVIDE(
CALCULATE(
COUNT('Model'[ID]),
'Model'[Event] = "A"
),
CALCULATE(
COUNT('Model'[ID])
)
)
pbi1.png
 
 
 
 
 
 
As you can see in the Image, I should expect 50%, 0 %, 0% ,0 %, 0% . How can I achieve this ?
1 ACCEPTED SOLUTION

Figured that would happen.  Try this instead.

 

NewMeasure = var vResult = [YourExpression]

Return IF(AND(NOT(ISBLANK([Count])), ISBLANK(vResult)), 0, vResult)

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

11 REPLIES 11
Tahreem24
Super User
Super User

Just tweak your measure like below:

DIVIDE(
CALCULATE(
COUNT('Model'[ID]),
'Model'[Event] = "A"
),
CALCULATE(
COUNT('Model'[ID])
)
) +0
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
aj1973
Community Champion
Community Champion

@RogerSteinberg 

Add 0 there

 

DIVIDE(
CALCULATE(
COUNT('Model'[ID]),
'Model'[Event] = "A"
),
CALCULATE(
COUNT('Model'[ID])
), 0
)

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Tried that but still have blanks on days without any EVent of type "A"

@RogerSteinberg 

 

Use IF(ISBLANK(Your Measure), "0", Your measure)

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

aj1973
Community Champion
Community Champion

@RogerSteinberg 

 

Use IF(ISBLANK(Your Measure), "0", Your measure)

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

the ISBLANK() function requires a parameter though. but if i put my measure inthere, i have the same issue with the proposed solution from mahoney below, i get dates from my date table where theres no data at all

Hi @RogerSteinberg 

Try this

Column = 

VAR _res = DIVIDE( CALCULATE( COUNT('Model'[ID]), 'Model'[Event] = "A"), CALCULATE( COUNT('Model'[ID]) ) ) 

RETURN

IF ( ISBLANK(_res), 0, _res)

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


@RogerSteinberg 

Please share a sample Pbix, It would be easier for us all to help you.

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

mahoneypat
Microsoft Employee
Microsoft Employee

Just add +0 to the end of your expression.

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


it adds also all the dates from my model where no data is generated. which is not what I want.  this happens when i have a 1to many relationswhip with my date table and use the date column from the date table.

Figured that would happen.  Try this instead.

 

NewMeasure = var vResult = [YourExpression]

Return IF(AND(NOT(ISBLANK([Count])), ISBLANK(vResult)), 0, vResult)

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors