2 Replies Latest reply on Sep 19, 2018 11:23 AM by Mahfooj Khan

    Percent column question.

    Priscilla Garza

      So currently I've made a percent difference column that returns N.A if specific values are zero or null, and the percent difference if not. The only thing I cant figure out is how to change the format of the decimal places. I know I could change it through the format tab but the problem is that I had to make it a string in order to get the return of N.A. in some columns.

       

      Here is the code I'm using:

      IF SUM([2017]) = 0 or SUM([2018]) = 0 then "N.A"

      ELSE

      STR(((SUM([2018])-SUM([2017]))/SUM([2017]))*100) + "%" END

       

      Here is an example of how the column looks with the above code.

       

       

      I've tried to fit the round function in the Else condition but can't figure out how exactly to make it work.

      I've also had a float version of the code that allowed me to change the decimal places but I couldn't add the "%" at the end of it.

      FLOAT(if SUM([2017]) = 0 or SUM([2018]) = 0 then "N.A"

      ELSE

      STR(((SUM([2018])-SUM([2017]))/SUM([2017]))*100) END)

       

      I would really like all 3 to work, the N.A., the % and the decimal places.

       

      If anyone has ideas then let me know!