cube-js / cube-js/cube

Support percents that are not multiplied by 100.

Open
#4,565 2 comments 0 reactions 0 assignees View on GitHub
help wanted logged reviewed
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

Generally, I want to handle formatting in the front-end code, not in Cube. For instance, if I want to display a number as a percentage in a table, then Cube will provide a ratio measure, and I'll turn it into a percentage string in the table column definition using Intl.NumberFormat. In particular, I expect Cube to provide a raw ratio, not a ratio multiplied by 100. This is consistent with the behavior of both Intl.NumberFormat and Excel, which will both turn `.1` into `10%` and `10` into `1000%`.

However, Cube's percent formatter will format `.1` as `0.10%` rather than as `10%`. This causes incorrect values to be displayed in the playground.

**Describe the solution you'd like**

Either a new `format` (e.g. `percentNormalized`) or a configuration option indicating that `percent` members are not multiplied by 100.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.