Formatting for Variables that have different ranges


I have a data set with a variable where the user can select a metric to view. Some choices are dollars / values and others are percentages. Any way to get the format to change depending on the metric chosen? As a side question to this, could the conditional formatting of the table be different based on the metric?
** Please like responses by clicking on the thumbs up
** Please Accept / check the answer that solved your problem / answered your question.
Best Answer
-
One option is to create a beast mode with a case statement that applies a dynamic format based on the variable. There is a MySQL Function called FORMAT() that you can use in a beast mode even though it's not a documented beast mode function and it will give you a validation error.
Something like this:
CASE WHEN `My Variable` = '$ Sold' THEN CONCAT('$ ', FORMAT(SUM(`Sold`),2))) WHEN `My Variable` = '% Change' THEN CONCAT(FORMAT(((SUM(`Current Value`) - SUM(`Previous Value`)) / SUM(`Previous Value`))*100,2),'%') ELSE FORMAT(SUM(`Units`),0) END
0
Answers
-
One option is to create a beast mode with a case statement that applies a dynamic format based on the variable. There is a MySQL Function called FORMAT() that you can use in a beast mode even though it's not a documented beast mode function and it will give you a validation error.
Something like this:
CASE WHEN `My Variable` = '$ Sold' THEN CONCAT('$ ', FORMAT(SUM(`Sold`),2))) WHEN `My Variable` = '% Change' THEN CONCAT(FORMAT(((SUM(`Current Value`) - SUM(`Previous Value`)) / SUM(`Previous Value`))*100,2),'%') ELSE FORMAT(SUM(`Units`),0) END
0 -
Hi @Shevy,
For charts and graphs, use a separate Beast Mode with the Tooltip function to dynamically switch between %, $, or units.
If you found this post helpful, please use 💡/💖/👍/😊 below! If it solved your problem, don't forget to accept the answer.
0 -
Don't love this solution but it can work. Thank you
Dojo Community Member
** Please like responses by clicking on the thumbs up
** Please Accept / check the answer that solved your problem / answered your question.0
Categories
- All Categories
- Product Ideas
- 2.1K Ideas Exchange
- Data Connections
- 1.3K Connectors
- 309 Workbench
- 17 Cloud Integrations
- Data & ETL
- 2.3K Magic ETL
- 120 SQL DataFlows
- 666 Datasets
- Visualize & Apps
- 90 App Studio
- 198 Pro-code Components
- 2.6K Charting & Analyzer
- 873 Calculations & Variables (Beast Mode)
- AI & Data science
- 23 Domo AI & AI Chat
- 4 Managing AI
- 18 Jupyter Workspaces
- Automate
- 122 Workflows
- Alerts
- Distribute
- 118 Domo Everywhere
- 284 Reporting
- Manage
- 145 Governance & Security
- 489 APIs
- 11 Add-ins & Plugins
- 13 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 118 Community Announcements
- 5K Archive