Formatting Variables
Hi, I am using a variable and some values are %, others are $. However, I the formatting doesnt seem to change when I try to switch them to a string by using concat and adding a % or $. They just come out as 1000 instead of $1000 or 57 instead of 57%.
Here is my beastmode. What might be causing this?
CASE
WHEN Pickup/Dropoff/Driving%
= 'OnTime Pickup%' THEN CONCAT(ROUND(100*(1 - (SUM(PUPSTOPCOUNT_LATE
) / SUM(PUPSTOP_COUNT
))),0), '%')
WHEN Pickup/Dropoff/Driving%
= 'OnTime Dropoff%' THEN CONCAT(ROUND(100*(1 - (SUM(DRPSTOPCOUNT_LATE
) / SUM(DRPSTOP_COUNT
))),0),'%')
WHEN Pickup/Dropoff/Driving%
= 'Driving%' THEN CONCAT(ROUND(sum(DRIVING_HRS
) / (sum(ON_DUTY_HRS
) +sum(DRIVING_HRS
)),0),'%')
WHEN Pickup/Dropoff/Driving%
= 'Rev' THEN CONCAT('$',ROUND(((SUM(revenue
) / COUNT(DISTINCT MPP_LASTFIRST
)) / COUNT(DISTINCT LOG_DATE
)),0))
WHEN Pickup/Dropoff/Driving%
= 'Dwell' THEN ROUND((Sum(((UNIX_TIMESTAMP(STP_DEPARTUREDATE
) - UNIX_TIMESTAMP(STP_ARRIVALDATE
)) / 60)) / COUNT(DISTINCT STP_NUMBER
)),0)
END
Answers
-
I'd recommend you split out each of your case statements into their own beast mode so you have just the formatting logic in each to see how each one applies to your data. This will help identify if there's an issue with your specific individual clauses or the entire beast mode.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
When I tried that idea (making all the lines a comment besides the one I wanted to test) none of them had the correct format. I even tried taking it out of the case statement and taking CONCAT(ROUND(100*(1 - (SUM(
PUPSTOPCOUNT_LATE
) / SUM(PUPSTOP_COUNT
))),0), '%') but the % would not show up.0 -
Are you specifically referring to the Variable option in DOMO which is different than a beast mode or are you just referencing the word variable as a descriptive identifier?
If DOMO variable, in your example, which field is the DOMO variable?
I would think you would need 2 DOMO variables to execute this, one that is % and one that is a $ and their is an option when you create the DOMO variable to select one of those.0 -
Jessica I am new to variables so Im not sure what you are asking. I am using one drop down variable with a chart to the left. If the variable is selected to show x then it will display the value corresponding to that KPI (if its related to a percentage then display a % at the end or if its related to a dollar amount then display a $ at the beginning.)
I use the variables name in the beastmode. For example
case
when Variables_name = x then display x's KPI
when Variable_name = y then display y's KPI
etc
0 -
I'm having the same issue with showing a $ amount and an integer amount. I don't agree with Jessica that you need 2 variables as this doesn't make sense for our use case. I have a variable button selector on the side to select $ revenue or # of partners. It doesn't make sense to split these out.
@GrantSmith any further suggestions for this?
My code is pretty straightforward:
The output is always a number value without the $ sign.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive