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, get a free DP-600 exam voucher to use by the end of 2024. Register 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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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