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
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 655 Datasets
- 115 SQL DataFlows
- 2.2K Magic ETL
- 811 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 80 App Studio
- 45 Variables
- 771 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 77 Workflows
- 23 Code Engine
- 36 AI and Machine Learning
- 19 AI Chat
- AI Playground
- AI Projects and Models
- 17 Jupyter Workspaces
- 410 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 10 Software Integrations
- 142 Manage
- 138 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 113 Community Announcements
- 4.8K Archive