4

How can I use Custom Column feature in Metabase to cast column from Text to Integer for sum calculation.

newbieLinuxCpp
  • 376
  • 2
  • 8
  • 23

2 Answers2

1

I found a workaround by setting 0 + column_name in the formula field. Maybe there's a cleaner way but I couldn't find it.

  • Sorry to hear that. Currently I'm using that workaround to cast a text field to the parsed numeric value and use the custom column for any kind of visualization or aggregation. Could you share any additional detail in order to better analyze your situation? – markomannux Feb 06 '20 at 20:14
  • I just noticed the postgresql tag. I'm working with mysql. I guess the reason for the different behavior lies in that. – markomannux Feb 06 '20 at 20:23
  • This workaround does not work for Postgres. – killakalle Sep 12 '22 at 15:51
1

If your database is Postgres, then you cannot.

See Metabase support answering this specific question in the Metabase forum. https://discourse.metabase.com/t/how-to-convert-str-to-int-in-custom-question/15049/7

killakalle
  • 82
  • 1
  • 9