cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

How to correct the Blank into 0 in Card Visual.

Hi, 
I have set a mesure show zero to the card visual when select a particular Status. 
Example, I select status "Healthy" from filter. My other card visual should have change to "0". 

Now, when I select a status, the other card visual remain with same value. It doesn't change to 0.
Here's my current measure that I set:
"Healthy 2 = IF(ISBLANK(CALCULATE(COUNT(Table10[Result 2]), Table10[Result 2] = "Healthy")), 0, CALCULATE(COUNT(Table10[Result 2]), Table10[Result 2] = "Healthy"))"



b128tkJoAS.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: How to correct the Blank into 0 in Card Visual.

Hi @pravind96 ,

 

We can use the following measures to fix it:

 

Healthy =
CALCULATE (
    COUNT ( 'Table10'[Result 2] ),
    'Table10',
    'Table10'[Result 2] = "Healthy"
) + 0

 

Infected =
CALCULATE (
    COUNT ( 'Table10'[Result 2] ),
    'Table10',
    'Table10'[Result 2] = "Infectet"
) + 0

 

Precaution =
CALCULATE (
    COUNT ( 'Table10'[Result 2] ),
    'Table10',
    'Table10'[Result 2] = "Precaution"
) + 0

 

Suspected =
CALCULATE (
    COUNT ( 'Table10'[Result 2] ),
    'Table10',
    'Table10'[Result 2] = "Suspected"
) + 0

 

Add a 'Table10', in the calculate formula.


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Highlighted
Super User IV
Super User IV

Re: How to correct the Blank into 0 in Card Visual.

Try:

Healthy 2 = 
VAR __MyVar =
	IF(
		ISBLANK(
			CALCULATE(
				COUNT(Table10[Result 2]), 
				Table10[Result 2] = "Healthy"
			)
		), 
		0, 
		CALCULATE(
			COUNT(Table10[Result 2]), 
			Table10[Result 2] = "Healthy"
		)
	)
RETURN
	IF(ISBLANK(__MyVar),0,__MyVar)

If that doesn't work, Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Highlighted
Frequent Visitor

Re: How to correct the Blank into 0 in Card Visual.

It's still showing the same results as mine. Other card visual doesn't show 0. 

Highlighted
Community Support
Community Support

Re: How to correct the Blank into 0 in Card Visual.

Hi @pravind96 ,

 

We can use the following measures to fix it:

 

Healthy =
CALCULATE (
    COUNT ( 'Table10'[Result 2] ),
    'Table10',
    'Table10'[Result 2] = "Healthy"
) + 0

 

Infected =
CALCULATE (
    COUNT ( 'Table10'[Result 2] ),
    'Table10',
    'Table10'[Result 2] = "Infectet"
) + 0

 

Precaution =
CALCULATE (
    COUNT ( 'Table10'[Result 2] ),
    'Table10',
    'Table10'[Result 2] = "Precaution"
) + 0

 

Suspected =
CALCULATE (
    COUNT ( 'Table10'[Result 2] ),
    'Table10',
    'Table10'[Result 2] = "Suspected"
) + 0

 

Add a 'Table10', in the calculate formula.


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Frequent Visitor

Re: How to correct the Blank into 0 in Card Visual.

Hi, thanks for the answer. It works. 

I found this code earlier. It works too.

Healthy 2 = IF(ISBLANK(CALCULATE(COUNT(Table10[Result 2]), Table10[Result 2] = "Healthy")), 0, CALCULATE(COUNT(Table10[Result 2]), Table10[Result 2] = "Healthy"))

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications