Organizations use AI/BI dashboard tables to review accounts, catch problems, and decide what to do next. Yet a plain table can hold all the right data and still be hard to read.
One way to improve the end user experience is to render HTML directly inside a table. AI/BI dashboard tables support an HTML display type, allowing an HTML string to render as something more visual and useful than plain text.
In this post, you'll build five reusable Unity Catalog functions that turn ordinary table values into:
In this blog we will build each pattern separately so you can see how it works in an AI/BI dashboard table. At the end, we'll bring all five together into a single table to see how these small enhancements can transform a traditional plain table.
We will build the following consumer-friendly table visual in AI/BI Dashboards using your Unity Catalog table:
Feel free to follow along using Databricks Free Edition!
How we will be implementing the HTML in a table visualization
Here are three main ideas we use in this post:
Before you start
A few things to keep in mind:
Step 1: Create the data and the Unity Catalog functions
|
Step 2: Create and name your dashboard
Let's build the table visualization with each function one pattern at a time.
For each build you:
Build 1: Color-coded status badges
Turn the plain health_status value into a pill-style badge. The function draws the pill and the query decides the color based on the value.
Create the dataset in AI/BI Dashboards
|
Add the table visualization
Here the CASE expressions in the html_badge() function carry the business logic:
Build 2: License utilization
Combine active_users and licensed_users into a single compact metric with a color-coded progress bar.
Create the dataset
|
Add the table visualization
The function computes active divided by licensed and colors the bar automatically: above 75% green, 30 to 75% amber, below 30% red.
Build 3: Usage trends
Turn a plain percentage change into a directional arrow.
Create the dataset
|
Add the table visualization
Positive values render a green up arrow, negative values a red down arrow, and zero a neutral dot.
Build 4: AI-prioritized action cards
This build combines an AI function (ai_classify) with a reusable HTML function.
The flow is: recommended action, then an AI-generated priority, then an HTML card.
Create the dataset
|
Add the table visualization
Here ai_classify() reads each recommended_action and returns one of High, Medium, or Low, and html_action_card() renders that priority as a colored card. Using a fixed label set keeps the output aligned with the card's colors.
A note on AI output: AI classification can vary, so always check the result and build this accordingly.
Build 5: Action links
Finish by turning the CRM URL into a clickable action. This is what makes the table more than a report: users can move straight from an insight to the system where they take the next step.
Create the dataset
|
Add the table visualization
The sample URLs use example.com as placeholders. In a real dashboard, this could point to Salesforce, ServiceNow, Jira, an internal app, or any other operational system.
You've built and tested each HTML pattern separately. Now let's combine them into a single dataset to see how they work together.
Create the dataset
|
Add the table visualization
Use Genie Code!
None of these Unity Catalog functions to return HTML were written from scratch.
Genie Code helped build them. You describe what you want in plain language, and it writes, explains, and refines the code for you. That is also how you should create and improve them. You can:
Made something better? Share your function and a screenshot in the comments. The best ideas help everyone!
Learn more
New to AI/BI Dashboards? The AI/BI for Data Analysts course on Databricks Academy covers building interactive dashboards, creating visualizations, using Genie Code for AI development, publishing, scheduling, and more.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.