Skip to main content
Question

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

  • January 9, 2025
  • 1 reply
  • 27 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

 

Did this topic help you find an answer to your question?

1 reply

GastonQ
Data Voyager
Forum|alt.badge.img+1
  • Author
  • Data Voyager
  • 2 replies
  • 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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings