Format numeric values to currency
Comments
-
Hi,
The MySQL Format function can format decimal fields to currency.
FORMAT(1232454.2573,2)
Result: 1,232,454.26
CONCAT('$', FORMAT(1232454.2573,2))
Result: $1,232,454.26Test it and let me know if that works for you.
0 -
Thanks, but that didn't quite work. It did convert the value to two decimal places with a comma, but it also converted it to a text value, instead of numeric, and that broke my card.
0 -
Can you let me know what you are trying to accomplish? The DOMO cardbuilder allows you to format numeric values as currency.
0 -
I have a beast mode that changes the summary number to read as a change in period over period, it wasn't originally written by me.
It will show the "Summary Number" as "$136949581 -- 10.46% YTD Change from Prior Year", but I want the commas in the number.
I can't use the format function in the beast mode, and I can't use it in MySQL because it changes it to a text value.
0 -
You can use the MySQL formula. You just have to save it as it's own field. So you could have a column for the raw number and another column for the formatted number. Then in the summary number you use the formatted column and use the raw number colun for therest of your card.
0 -
I tried that, but I can't use the formatted in the calculation as they are formatted as text.
This is the beast mode calculation:
CONCAT(
'$'
,round((sum(case when `Period` = 'CurrentYear' then `SellSideVolume`+`ListSideVolume` else 0 end)-sum(case when `Period` = 'PriorYear' then `SellSideVolume`+`ListSideVolume` else 0 end)),0)
,' -- '
,round(((sum(case when `Period` = 'CurrentYear' then `SellSideVolume`+`ListSideVolume` else 0 end)-sum(case when `Period` = 'PriorYear' then `SellSideVolume`+`ListSideVolume` else 0 end))/sum(case when `Period` = 'PriorYear' then `SellSideVolume`+`ListSideVolume` else 0 end))*100,2.00)
,'% '
,'YTD Change from Prior Year'
)0 -
Unfortunately, there is no other way to accomplish this unless you do all your calculations in SQL. However as you know, going that route will diable the ability to recalulate your metric on the fly as the card is manipulated by end users.
0 -
Okay, thanks for the suggestions though, much appreciated.
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
- 657 Datasets
- 115 SQL DataFlows
- 2.2K Magic ETL
- 815 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 81 App Studio
- 45 Variables
- 775 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 81 Workflows
- 23 Code Engine
- 40 AI and Machine Learning
- 20 AI Chat
- 1 AI Playground
- 1 AI Projects and Models
- 18 Jupyter Workspaces
- 410 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 10 Software Integrations
- 144 Manage
- 140 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 114 Community Announcements
- 4.8K Archive