Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Significant figures in a column

Hi! I need to format a column so that the significant figures are consistent throughout (for example, 204 and 12 would be 204 and 12.0). I've tried every format and data type I can find, but always end up with a certain number of decimal places, not digits.

Any advice would be greatly appreciated! Thanks-

  • Anonymous's avatar
    Anonymous
    7 years ago

    I don't know of any function that could do it on its own, but would it be a possibility for you to set it up yourself using something like a switch?

     

    If you know you have numbers between 0 and 999, something like this:

    Measure = SWITCH(TRUE(),
        [number] < 100, FORMAT([number], "0.0"),
        [number] < 10, FORMAT([number], "0.00"),
    FORMAT([number], "0"))

    with [number] as whatever measure/column you need to format. If you don't know what range of number you'll have... I'm not sure if there's a neat way to go about it without reinventing the wheel.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I don't know of any function that could do it on its own, but would it be a possibility for you to set it up yourself using something like a switch?

     

    If you know you have numbers between 0 and 999, something like this:

    Measure = SWITCH(TRUE(),
        [number] < 100, FORMAT([number], "0.0"),
        [number] < 10, FORMAT([number], "0.00"),
    FORMAT([number], "0"))

    with [number] as whatever measure/column you need to format. If you don't know what range of number you'll have... I'm not sure if there's a neat way to go about it without reinventing the wheel.

    • Anonymous's avatar
      Anonymous
      Not applicable

      That did it! Thank you so much!