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
spandy34
Responsive Resident
Responsive Resident

DAX help - Blank field

I have the measure below.  At the moment if there are no records that meet the criteria, the field will display the word 'Blank'.  How could i amend it so it displays a zero '0' please?

 

= CALCULATE(

   COUNTA('Procurement_Main_Data'[SSRef]),

    'Procurement_Main_Data'[Short Visit]= "Yes")

@amitchandak @tamerj1 @danextian @goncalogeraldes 

3 ACCEPTED SOLUTIONS
mlsx4
Super User
Super User

Hi @spandy34 

 

You can do the following:

 

Measure=

var _myVar= = CALCULATE(

   COUNTA('Procurement_Main_Data'[SSRef]),

    'Procurement_Main_Data'[Short Visit]= "Yes")

return 
   IF(ISBLANK(_myVar),0,_myVar)

 

View solution in original post

KeyurPatel14
Resolver IV
Resolver IV

Hello @spandy34 ,
You can simply add 0 at the end of the measure.
Please check below measure to achieve the solution:

= CALCULATE(

   COUNTA('Procurement_Main_Data'[SSRef]),

    'Procurement_Main_Data'[Short Visit]= "Yes") + 0

Kindly accept it as a solution if it helps.

View solution in original post

pankaj_lp
Helper I
Helper I

Check if this works?

Count Short Visit =
VAR ShortVisitCount =
CALCULATE(
COUNTA('Procurement_Main_Data'[SSRef]),
'Procurement_Main_Data'[Short Visit] = "Yes"
)
RETURN
IF(ShortVisitCount <> 0, ShortVisitCount, 0)

View solution in original post

7 REPLIES 7
spandy34
Responsive Resident
Responsive Resident

Great thank you

pankaj_lp
Helper I
Helper I

Check if this works?

Count Short Visit =
VAR ShortVisitCount =
CALCULATE(
COUNTA('Procurement_Main_Data'[SSRef]),
'Procurement_Main_Data'[Short Visit] = "Yes"
)
RETURN
IF(ShortVisitCount <> 0, ShortVisitCount, 0)

THank you it works

KeyurPatel14
Resolver IV
Resolver IV

Hello @spandy34 ,
You can simply add 0 at the end of the measure.
Please check below measure to achieve the solution:

= CALCULATE(

   COUNTA('Procurement_Main_Data'[SSRef]),

    'Procurement_Main_Data'[Short Visit]= "Yes") + 0

Kindly accept it as a solution if it helps.

Thank you it works!

mlsx4
Super User
Super User

Hi @spandy34 

 

You can do the following:

 

Measure=

var _myVar= = CALCULATE(

   COUNTA('Procurement_Main_Data'[SSRef]),

    'Procurement_Main_Data'[Short Visit]= "Yes")

return 
   IF(ISBLANK(_myVar),0,_myVar)

 

spandy34
Responsive Resident
Responsive Resident

Thank you it works

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.

Top Solution Authors