Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

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 FY25Q4 FY24Q3 FY24Q2 FY24
Passengers06.25.25.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

  • 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:

     

  • Anonymous 

     

    I'm curious why my solution didn't work for you.

     

    Regards

     

    Phil

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      I never said it didn't work.  I like the explict control of measure.