Skip to content

Rounding feature for SUM additive measure #9065

Open
@hamsof

Description

@hamsof

In cube.js there is not a feature when you want to apply rounding after the additive measured value.

 some_measure_1: {
      sql: `
        ${CUBE}.col1 - ${CUBE}.col2
      `,
      type: `sum`,
}

we have to introduce another measure for its rounded value

 some_measure_2: {
      sql: `
       ROUND(${CUBE.some_measure_1}, 2)
      `,
      type: `number`,
}

or we have to change the type to number and introduce our own sql

 some_measure_3: {
      sql: `
       ROUMD(SUM({CUBE.some_measure_1}),2)
      `,
      type: `number`,
}

I am currently using this approach.

There should be some in additive measure object that should should accept rounding integer if required.
like

 some_measure_1: {
      sql: `
        ${CUBE}.col1 - ${CUBE}.col2
      `,
      type: `sum`,
     round: 2
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions