Conditional Formatting Workaround in Pivot Table
In my organization, my role is cardbuilder. I have built a pivot table and ran into some issues with conditional formatting.
In my table, I have Daily Budget and Net Cost as two columns broken out by day. Ideally, I wanted the Net Cost column to turn RED (could be font or background - just something to flag it) if Net Cost > Daily Budget for that day. Given my data set has many different "advertising campaigns" that have different daily budgets, I cannot assign a specific dollar amount in the color rules. In an ideal world, I wish I could just tell it to turn red if Net Cost > Daily Budget column in the setup. From what I read, this is just a current "limitation" on how conditional formatting works at the moment.
As a "workaround", I created a new column called Overage. It basically shows the value if net cost exceeds daily budget for that day. (see screenshot). I did research and used a beast mode someone posted here that utilizes HTML as a workaround to spit out values in designated colors in my Overage Beast mode. This is the beast mode I used:
CASE WHEN (sum(`Net Cost`) - sum(`Daily Budget`)) > 0
CONCAT('<div style="background-color:#FF0000; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#FF0000">', sum(`Net Cost`)
sum(`Daily Budget`) , '</a></div>')
for some reason I keep encountering these issues:
- No matter what color code I use in the beast mode, the result always ends up the color in my screenshot (bluish)
- I tried adding in some <font> html codes, but no go
- I set the data format for the beast mode as currency ($) with 2 decimals but it doesn't follow this.
- is this because the beast mode shows up as "text string" vs "numeric"? How would I change that?
Any guidance would be helpful and appreciated!
ohh, I just found a workaround for this. Given the limitation on html markup for the pivot table, I modified my beast mode and then enabled "show negative numbers red" in the chart settings.
I'm sure there are many ways to write this beast mode, but the change I made is in the second statement. Now, if there is an overage it will spit out a negative number and the "show negative numbers red" setting will flag it red.
CASE WHEN (sum(`Net Cost`) - (SUM(DISTINCT `Daily Budget`))) > 0
THEN (sum(distinct `Daily Budget`)) - sum(`Net Cost`)
screenshot attached. thanks for helping everyone. i feel mildly successful for a Friday ?1
You're getting bluish text because you have a hyperlink tag (<a href...) surrounding your text causing it to default to blue. Try taking out the <a> tags.
Are you wanting the background to be red or the text to be red?
Typically I've done the following to make the text red:
CONCAT('<div><span style="color: red">', `field`, '</span></div>')**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0
Unless they made changes AFAIK pivot tables don't have support for HTML formatting. But let me know!Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1
I tried that but what happens is it returns all the code starting with <DIV> in the pivot table. Per the other poster here it might just be a limitation on the pivot table. I'll try it on another type of table for my own learning but ultimately need the pivot table. I'll submit it as a product suggestion to domo. thanks all!0
- 7.7K All Categories
- 2 Connect
- 918 Connectors
- 244 Workbench
- 476 Transform
- 1.8K Magic ETL
- 60 SQL DataFlows
- 446 Datasets
- 35 Visualize
- 198 Beast Mode
- 2K Charting
- 8 Variables
- 16 Cards, Dashboards, Stories
- 1 Automate
- 348 APIs & Domo Developer
- 82 Apps
- 14 Predict
- 3 Jupyter Workspaces
- 11 R & Python Tiles
- 241 Distribute
- 59 Domo Everywhere
- 241 Scheduled Reports
- 15 Manage
- 36 Governance & Security
- 24 Product Ideas
- 1.1K Ideas Exchange
- Community Forums
- 15 Getting Started
- 1 Community Member Introductions
- 49 Community News
- 18 Event Recordings
- 579 日本支部