Skip to main content
Question

How to create a metric with decimal places in Data Story?

  • January 9, 2025
  • 1 reply
  • 38 views

GastonQ
Data Voyager
Forum|alt.badge.img+1

Hi, I’m working with data stories, and I’ve created a custom metric to represent by using percentage format.

This is the metric expression:

iff(sum("Valid") + sum("Invalid") > 0, round(sum("Valid") * 100/ (sum("Valid") + sum("Invalid")), 2) / 100, 0)

Both β€œValid” and β€œInvalid” are defined in Snowflake as REAL datatype.

I’ve read this articleΒ Create Custom Attributes :: Ataccama ONEΒ and I’m using round function, but it doesn’t work.

Thanks in advance,

Gaston

Β 

1 reply

GastonQ
Data Voyager
Forum|alt.badge.img+1
  • Author
  • Data Voyager
  • January 9, 2025

Solution: if you want to control the decimal places...do not use β€œroundβ€Β πŸ˜•

​​​​​​​iff(sum("Valid") + sum("Invalid") > 0, sum("Valid") * 100/ (sum("Valid") + sum("Invalid")) / 100, 0)

I think this is a bug, because if I need to display 3 or more decimal places...I have to use round.