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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
zraopingm
Helper IV
Helper IV

format zero and blanks with dash

Hello 

Is there a way to format zeros and blanks with dash? 

 

thank you 

Zoey

 

1 ACCEPTED SOLUTION

I think this part of your solution will cause an error when you try to compare a number to text using the "equals" comparison?  IE one or the other of these could cause an error 

_Calculation = 0, "-",
_Calculation = "","-",

 

Therefore I think it is simpler to just use coalesce to resolve blanks to zeros.  I also eliminated the "empty string" option entirely because it was not mentioned by @zraopingm .

 

Measure_Name = 

VAR _Calculation  = COALESCE([Calculation], 0)
RETURN
IF(_Calculation = 0, "-"_Calculation)


///Mediocre Power BI Advice, but it's free///

 

View solution in original post

5 REPLIES 5
ExcelMonke
Super User
Super User

Glad to have been able to help @zraopingm. I would try @kpost's solution first before moving onto mine - I think it is the better one. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hello, 

I tried both, COALESCE works perfect( see below), and yes, switch gave me the calssic error. 

zraopingm_0-1747311012946.png

 

thank you

Zoey

zraopingm
Helper IV
Helper IV

Thank you all for the great suggestions! I am going to try them on desktop. Meanwhile, I was able to solve the issue via power pivot after some effort,  that is where my final destination.

But I am definitely going to try all of the suggestions you kindly provided to me. I will let you know in one or two days.  Thank you kindly again Zoey

ExcelMonke
Super User
Super User

Hello,

One solution you can consider is using a SWITCH function, like so:

Measure = 

VAR _Calculation = [Calculation]

RETURN
SWITCH(TRUE(),
_Calculation = 0, "-",
_Calculation = "","-",
ISBLANK(_Calculation),"-",
_Calculation
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





I think this part of your solution will cause an error when you try to compare a number to text using the "equals" comparison?  IE one or the other of these could cause an error 

_Calculation = 0, "-",
_Calculation = "","-",

 

Therefore I think it is simpler to just use coalesce to resolve blanks to zeros.  I also eliminated the "empty string" option entirely because it was not mentioned by @zraopingm .

 

Measure_Name = 

VAR _Calculation  = COALESCE([Calculation], 0)
RETURN
IF(_Calculation = 0, "-"_Calculation)


///Mediocre Power BI Advice, but it's free///

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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