Forum Discussion
Card 0 value without decimal places
How to format a 0 value without decimal places in a card, but keep decimal values when passengers are greater than 0?
This card should be 0, not 0.00 unless real data is presented in the data source. I am adding +0 to my SUM measure to prevent BLANK.
| Q1 FY25 | Q4 FY24 | Q3 FY24 | Q2 FY24 | |
| Passengers | 0 | 6.2 | 5.2 | 5.7 |
Anonymous
Apply a Custom Format String to the value/measure - just select the value/field/measure and type this into the Format area on the Ribbon and hit enter
0.0;;0;Regards
Phil
Hi Anonymous ,
You get the desired result by the DAX bellow:Formatted Measure = VAR measureValue = SUM(YourTable[YourColumn]) + 0 -- Adding +0 to prevent blank RETURN IF( measureValue = 0, FORMAT(measureValue, "0"), -- Display 0 without decimals when the value is zero FORMAT(measureValue, "0.00") -- Display with two decimals when the value is greater than 0 )
Make sure that the Callout value decimal places of your card was set to Auto:
4 Replies
- PhilipTreacy
Super User
Anonymous
Apply a Custom Format String to the value/measure - just select the value/field/measure and type this into the Format area on the Ribbon and hit enter
0.0;;0;Regards
Phil
- Bibiano_Geraldo
Super User
Hi Anonymous ,
You get the desired result by the DAX bellow:Formatted Measure = VAR measureValue = SUM(YourTable[YourColumn]) + 0 -- Adding +0 to prevent blank RETURN IF( measureValue = 0, FORMAT(measureValue, "0"), -- Display 0 without decimals when the value is zero FORMAT(measureValue, "0.00") -- Display with two decimals when the value is greater than 0 )
Make sure that the Callout value decimal places of your card was set to Auto: - PhilipTreacy
Super User
Anonymous
I'm curious why my solution didn't work for you.
Regards
Phil
- AnonymousNot applicable
I never said it didn't work. I like the explict control of measure.