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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
Memorable Member
Memorable Member

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
Memorable Member
Memorable Member

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
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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