question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add the number style `k`, `B`, `M` to the dimension + metric config

See original GitHub issue

Description: What is it?

in the metric or dimension configuration, you can add a style option to make the numeric field into units of thousands, millions, billions.

You can do this using compact = k, m, b or default

Problem: What problem does this solve?

Sometimes, I want my values to be formatted in different units to the raw data

What: Roughly, what does this look like in the product?

name: revenue
  meta:
    dimension: 
      compact: default
    metrics:
      total_revenue:
        type: sum
        compact: k
  • If I had the revenue values (the first dimension in the example above with compact = default) of 1,000,000 and 150,000, then they would appear as 1m and 150k in Lightdash
  • If I had the total revenue values (the metric in the example above with compact = k) of 1,000,000 and 150,000, then they would appear as 1,000k and 150k in Lightdash.
  • Unit options are: ‘k’ or ‘thousands’ for thousands, ‘m’ or ‘millions’ for millions, ‘b’ or ‘billions’ for billions
  • By default, there are 2 decimal places. (e.g. 1,550,000 with compact = m would appear as: 1.55m). If there were only 0s after the number, then it would still appear with two decimal places (e.g. 1,000,000 with compact = m would appear as: 1.00m).
  • Users can override the number of decimal places shown using the round. So, round gets applied after compact. For example, if I had the value 1,550,000 with compact = m and round = 1, it would appear as 1.6m.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
JohnRomanskicommented, Jun 3, 2022

I agree that Tableau has the best of both worlds. Also remember to include date formatting options:

3 Jun 03 Jun Jun 3 June 3rd 06/03 6/3 6.3 2022-06-03 etc

1reaction
thedataguy-officialcommented, Sep 23, 2022

I think that there should be a default solution configurable in dbt (especially useful for dates, currency formats, etc), but also the ability to overwrite this in the UI depending on the analyst and the use case.

For example, it could be monthly reporting is in the thousands, but year-to-date reporting is in the millions. It could be that Finance would want full figures reported. UI-wise, I’ll add a vote to the Tableau-like solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AutoCAD Custom Dimension Style Setup Imperial & Metric!
AutoCAD Fundamentals & Workflows Course: http://cadintentions.com/hurry** AutoCAD Productivity Training Webinar Available Now 20% off: ...
Read more >
Formatting Metric Data
1. Click the Configure Metric Attributes icon to the right of the Metrics header. The Available Metrics dialog page displays. 2. In the...
Read more >
Custom Metrics (CX) - Qualtrics
Click on the Settings icon. · Click on the Custom Metrics tab that is on the left side of the settings screen. ·...
Read more >
Create and edit custom dimensions and metrics - Analytics Help
In the PROPERTY column, click Custom Definitions > Custom Dimensions. Click New Custom Dimension. Add a Name. This can be any string, but...
Read more >
Format a number as 2.5K if a thousand or more, otherwise 900
(determines SI symbol) var tier = Math.log10(Math.abs(number)) / 3 | 0; ... scale the number var scaled = number / scale; // format...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found