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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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

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

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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