What is the value_format of negative percent?

I have a measure which would turn out to be a percentage of negative values e.g. -40%. The value_format I put in is "#.0000;(#.0000)" so I expect it would show up as -0.4000 and I can reformat it in the Visualization. But instead, it appears as 0 so I wondered maybe it got rounded up? I checked the two dimensions that this measure is based on - they have correct numbers. So it is not a matter of incorrect calculation but rather a wrong formatting. 

I also have another measure which would show up as something like 169% but it returned as 200% and the format is decimal_2. I set it as decimal_2 so I thought it would populate as 168.57.

So my question is - 

What is the value_format input of 

  1. negative percent
  2. percentage > 100%

Thanks!

0 2 1,651
2 REPLIES 2

Not sure why your numbers are losing precision (can you verify values in the database are stored with precision and not as integers)? If you are using a calculation you may need to cast at least one of your numeric fields as a decimal. for example:

cast(number_field_1 as decimal(18,2)) / number_field_2

or 

(1.0*number_field_1) / number_field_2

Looker does have built-in value_format_name for percent (e.g., percent_1, percent_2). More info here

Hey @JenniferThomas, I solved it by using /10.0. Thanks!

Top Labels in this Space
Top Solution Authors