Question

Custom (ECMA 376) format for conditional display of decimal place within tick values, when including a suffix character

  • 28 April 2021
  • 0 replies
  • 2 views

I’ve built a dashboard that has a y axis with a set of tick values from 0.5 to 2.5, at increments of 0.5 (i.e. 0, 0.5, 1, 1.5, 2 and 2.5).  This is achieved by using the default (i.e. blank) format.

 

I’d like to include a suffix character string of ‘ d’ to the value, to signify that the values represent a number of days (i.e. ‘0.5 d’, ‘1 d’, ‘1.5 d’, ‘2 d’ and ‘2.5 d’). Is there a way to conditionally display a decimal point in this manner?

 

For reference, I’m currently using the following format, however it displays integer values as decimals (i.e. ‘1.0 d’ and ‘2.0 d’), which isn’t ideal:

0.0#" d";;

 

As Looker’s default format is able to conditionally display decimals, I was hoping this would also be possible when using a custom format to include the suffix character noted above.  I’ve tried looking online for a Looker-related answer, in addition to checking some common formats represented using the underlying ECMA-376 standard, however I wasn’t able to solve the above problem.

 

I did also think about using a conditional formatting approach, however I wasn’t able to include a reference back to the specific value, or include SQL functions (e.g. comparing the value of floor(x) to x as a method of conditionally displaying the decimal).

 


0 replies

Be the first to reply!

Reply