Format number as money in Canvas

Hey guys,

I realize there is already a couple of open issues related to this:

However, I was wondering if anyone knows another way to format a number to display as a currency (formatted with commas).

e.g. 1000000 becomes 1,000,000

In my case I am using essql:

SELECT ROUND(dollar_amount, 2)
FROM "index"

is there a way to achieve this without the use of the 'money' datatype (I don't think this type is supported in essql yet) or without a number formatting option?

Thanks!

Hi @clintandrewhall can you help on this issue?

Figured it out!

I had to use the expression editor and just had to add this line to format the number using numeral.js:
| formatnumber format='$0,0[.]00'

so the whole expression would look something like this:

filters
| essql
  query="SELECT ROUND(dollar_amount, 2)
FROM \"index\""
| math "metric"
| formatnumber format='$0,0[.]00'
| metric ""
  metricFont={font size=48 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align="center" lHeight=48} 
  labelFont={font size=14 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align="center"}
| render

Thank god you guys included autocomplete functionality in that editor for 6.5.4 haha

Cheers

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.