Forum Discussion
format zero and blanks with dash
- 1 year ago
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)RETURNIF(_Calculation = 0, "-", _Calculation)
///Mediocre Power BI Advice, but it's free///
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
)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 =
///Mediocre Power BI Advice, but it's free///