Forum Discussion

linphan's avatar
linphan
Frequent Visitor
8 years ago

Display Infinity & NaN value as a text

Hello, Im newbie in power Bi community. I have a question to display Infinity & NaN as 2 different values.

Im using matrix to dislay gap (%) between actual volume & forecast volume. And I need to do conditioning format to display gap as below:

  • If gap = Infitity, display "+"
  • If gap = NaN, dispay "-"

 

I tried to use Divide but both Infinity & NaN value are display blank. What can I do to display as expected?

3 Replies

  • v-yuta-msft's avatar
    v-yuta-msft
    Community Support

    Hi linphan,

     

    In power query, 0/0 or Number.NaN(0, 0) will display NaN, number/0 or Number.Nan(number, 0) will display Infinity.

    But in DAX, the result is same with power query if you use symbol “/”, the result will be replaced by BLANK() if you use DIVIDE() function.

    So you can use “/” instead and then use DAX below:

    Column = SWITCH(Table1[Value], "Infinity", "+", "NaN", "-", Table1[Value])

     

    Regards,

    Jimmy Tao

    • linphan's avatar
      linphan
      Frequent Visitor

      Hi Jimmy,

       

      Switch function does not work. I got the error as below

      "Function SWITCH does not support comparing values of type Number with value of type Text. Condider using VALUE or FORMAT to convert one of the values"