0

is there any method to roundup the decimal values for example in measures i am defining BaseAmount:{ sql:'BaseAmount', type:sum }, I am getting sum of all baseAmount value like this 693.3399999999993 because here I mentioned type as sum I need to round up these values as 693.3 for that what type I need to declare

  • To perform this directly in Cube and not in js, you can do: `BaseAmount:{ sql:'round(sum('BaseAmount'), 1), type:number }` – Étienne Dec 15 '21 at 10:15

1 Answers1

0

You can use the Math.round function in js. See the below snippet.

let sum = 693.3399999999993;
let rounded = Math.round( sum * 10 ) / 10;

console.log(rounded)
Learner
  • 8,379
  • 7
  • 44
  • 82