Forum Discussion

ppgandhi11's avatar
ppgandhi11
Helper V
7 years ago
Solved

Data formatting question - Desktop

Hi,

 

I have a measure that brings values for some of the records. So wherever it is applicable, it brings correct values. At other rows, it remains blank because it is not applicable there.

 

I want to put N/A for all other rows since for those rows, the measure value is not applicable. How do I do that? Is there a way to put a default value of N/A wherever it is blank? Thanks a lot! 

 

  • ppgandhi11 try following

     

    Measure Val =
    VAL myCalculation = SUM( Table1[Amount]) -- put your measure calculation here
    RETURN
     IF( myCalculation = BLANK(), "N/A", myCalculation)

4 Replies

  • ppgandhi11 try following

     

    Measure Val =
    VAL myCalculation = SUM( Table1[Amount]) -- put your measure calculation here
    RETURN
     IF( myCalculation = BLANK(), "N/A", myCalculation)
    • ppgandhi11's avatar
      ppgandhi11
      Helper V

      ah, that works!

       

      you meant var not val in 2nd line, but i got it working!  Thanks a lot! 

  • S184019's avatar
    S184019
    Advocate III

    ppgandhi11

     

    Perhaps this can be resolved before it becomes tabular.  If in the query editor, the field exists with zeros (or blanks), then it should be possible to convert the field to text and do replace blanks (or zeros) with n/a's.  

  • dedelman_clng's avatar
    dedelman_clng
    Community Champion

    You can, but then you lose the formatting capability a measure being a number.

     

    MeasureOrNA = 
      var __MyMeasure = [Measure Calculation here]
      return
      IF ( ISBLANK( __MyMeasure), "N/A", __MyMeasure )

    You may be able to use the FORMAT function (FORMAT( __MyMeasure, "Percent") to make it look like a percentage.

     

     

    Hope this helps,

    David