Knowledge Drop

Is it expected that Looker will round very large numbers? (lose precision)

  • 5 April 2021
  • 0 replies
  • 142 views

Userlevel 5

Last Tested: Jul 3, 2018

 

Yes, the limitation will happen at around 16-17 digits and it will round the additional integers into "0"s. For example:

5820847388981125942 becomes

5820847388981126000

Overall it is a precision limit of javascript.

Workarounds

  1. Use {{ rendered_value }}

dimension: id {

primary_key: yes

type: number

sql: ${TABLE}.id ;;

html: {{ rendered_value }} ;;

}

 

  1. Use two dimensions

- dimension: string_value

type: string

sql: ${TABLE}.myfield

order_by_field: int_value

 

- dimension: int_value

type: number

sql: ${TABLE}.myfield

 

SQL Runner

SQL Runner will also render the lost precision numbers. The workaround for SQL Runner is to have the value casted as a STRING in the query itself. This can vary dialect to dialect.

 

This content is subject to limited support.                

 


0 replies

Be the first to reply!

Reply