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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
spandy34
Post Patron
Post Patron

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
Post Patron
Post Patron

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)

 

Thank you it works

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.