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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
stokidez
Helper III
Helper III

Display 0 or Null where the Card criteria does not find records

Hi folks,

 

Is it possible to replace the value of 'Blank' in this card to either null or 0 when the condition does not find any records please?

 

Capture.PNG

 

Thanks,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

measure= IF(ISBLANK(COUNT('Breach Log'[Date Identified (GMT)])), 0, COUNT('Breach Log'[Date Identified (GMT)]))

View solution in original post

18 REPLIES 18
Anonymous
Not applicable

1. Create a New column like 

If( ISBLANK('Breach Log'[Date Identified (GMT)]) , 0 , 'Breach Log'[Date Identified (GMT)])
2. Use this new column in your Card visual or in your calculated Measure

Hi @Anonymous I get the following message - what am I doing wrong?

 

stokidez_3-1616504323567.png

 

Anonymous
Not applicable

Hi @stokidez 

 

Please create a column not Measure

Krutigawale33
Responsive Resident
Responsive Resident

Hello @stokidez ,

Try with the measure

 

Measure = COALESCE(MAX('Breach Log'[Date Identified (GMT)]),0)

Hi @Krutigawale33, this returns a value in the thousands as opposed to 0 which was the expected result 

 

stokidez_1-1616502351947.png

 

 

Hi @stokidez ,

Try with this..

Measure = COALESCE ( COUNT('Breach Log'[Date Identified (GMT)]),0)
Anonymous
Not applicable

Hello,

Please try any of the following :

 

  1. IF ( ISBLANK( [measure] ), 0 , [measure] )
  2. COALESCE( [measure] , 0 )

 

Sorry I couldn't get this to work with either formula - do you know where I'm going wrong? Thanks.

 

stokidez_0-1616500057556.png

stokidez_1-1616500136798.png

 

Anonymous
Not applicable

  • Here, you are using column and and you cannot display it in a card.
  • To display in a card, you have to use measure which gives scalar value, DAX for this is: 
    • IF ( ISBLANK( [measure] ), 0 , [measure] )
  • Talking about the error in a picture, you have to close the round bracket Immediately after ISBLANK DAX. You have closed the bracket at the end of DAX which gives you error.

Sorry @Anonymous I'm a real newbie here so if you can spell it out it would be appreciated.

 

My field is titled 'Breach Log'[Date Identified (GMT). The card has a filter which is after X date and before Y date. There are currently no records which match that criteria. How do I show null or 0 if there are no records returned?

 

 

Anonymous
Not applicable

Measure= IF(ISBLANK(SUM('Breach Log'[Date Identified (GMT)])), 0, SUM('Breach Log'[Date Identified (GMT)]))

@Anonymous Thanks for the response. I get the following result 0.00. However, I expect over time that records will meet the date criteria set - I've amended my date range and it gives me a value not a count of the number of instances where that date range appears in the data-set.

 

stokidez_1-1616503890556.png

 

If I amend the date range so it picks up records, there are actually 19 which match this date range, however the measure shows 44k.

 

stokidez_2-1616503976197.png

 

 

 

Anonymous
Not applicable

measure= IF(ISBLANK(COUNT('Breach Log'[Date Identified (GMT)])), 0, COUNT('Breach Log'[Date Identified (GMT)]))

Thanks again @Anonymous - It worked! Many thanks for your perseverance!

 

 

 

Jihwan_Kim
Super User
Super User

Hi, @stokidez 

Please try to write your DAX measure in the card visual like below.

 

cardvisual = 

COALESCE (your measure, "")
 
Please let me know if it works.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


@Jihwan_Kim I tried your forumla, I'm obviously doing something wrong - if you could point me in the right direction that would be great.

 

stokidez_1-1616495215091.png

 

amitchandak
Super User
Super User

@stokidez , +0 in measure 

example 

meausre = sum(Table[Value])+0

 

 

Hiya @amitchandak , I've tried your forumula with my field but I receive the following error - what am I doing wrong please? My field is called Date Identified (GMT)

 

stokidez_0-1616494978614.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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