KNIME logo
Contact usDownload
Read time: 6 min

Visualize your Revenue Growth KPI with K-AI

A step-by-step tutorial to leverage KNIME’s AI assistant to build a custom bar chart in seconds

November 7, 2024
Automation inspirationData visualization
KPI Revenue Growth
Stacked TrianglesPanel BG

Revenue growth is one of the most common key performance indicators (KPI) companies want to calculate and keep track of. Merely looking at the figures in a table makes it hard to see trends, identify patterns and communicate them to others. That’s why it’s a good idea to visualize it.

Using data visualization can help us reveal and communicate meaningful insights in the data in a straightforward, effective and quick way. With interactive and responsive plots, we can even actively engage the user, allowing them to zoom in and out, look at growth over a specific period, or filter and select specific data dimensions to display the specific visualizations they need.

KNIME Analytics Platform offers a lot of View nodes for data visualization. These nodes are intuitive, easy-to-use, and can generate highly responsive and interactive plots. With the introduction of KNIME AI Assistant (K-AI), we can now use AI to build data visualizations with less time and effort. All we need to do is to tell K-AI what we want to visualize and how we want it to look, and it will do it for us in seconds.

In this blog post, we’ll look at a simple use case to investigate the power of K-AI for custom visualizations. In particular, we’ll ask K-AI to build a bar chart with a juxtaposed line plot to display the revenue growth KPI of a simulated software company over the course of a year. 

Basic and AI-generated bar chart visualization.  On the left is the basic result, on the right is the result  with K-AI.
Figure 1: Basic and AI-generated bar chart visualization. 
On the left is the basic result, on the right is the result 
with K-AI.

Download the workflow from the KNIME Community Hub and follow along.

Use case: Visualize the Revenue Growth KPI

Revenue Growth is a KPI that shows the increase in revenue from one period to the next. In this example, the periods are represented by months. A different granularity can be chosen, but “month” is often the standard choice for businesses.

Revenue Growth formula. A more detailed  explanation of the KPI can be found in the dedicated  blog.
Figure 2: Revenue Growth formula. A more detailed explanation of the KPI can be found in the dedicated blog.

A common way to visualize the Revenue Growth KPI evolution over time is with a bar chart, where each month is associated with a bar proportional to the revenue growth. 

KNIME offers a dedicated Bar Chart node, which can be configured with a wide variety of options, such as setting axis limits, arranging bars in a grouped or stacked way, and choosing how to group the bars. These possibilities can be extended by adding nodes before the bar chart (e.g., coloring the bars using the Color Manager node).

Detail of Bar Chart node configuration dialog. 				The visualization represents the monthly percentage of revenue growth.
Figure 3: Detail of Bar Chart node configuration dialog. The visualization represents the monthly percentage of revenue growth.

The Bar Chart node is easy to configure and generates a neat chart. However, sometimes we might need a bit more customization to display KPIs the exact way we want. For example, we may want to juxtapose the bar chart of revenue growth with a line plot representing the sum of the revenues. Something that is not possible with the simple Bar Chart node.

The quickest solution is to leverage K-AI’s friendly interface and generative capabilities in combination with the endless data visualization possibilities of the Generic ECharts View node.

How to build custom bar chart with K-AI

To access K-AI, we only need to sign in to the KNIME Community Hub and install (for free) the KNIME AI Assistant (Labs) extension.

K-AI features a Q&A mode to answer KNIME-oriented questions, and a Build mode to assist us with workflow creation. The Build mode lets us ask K-AI to automatically assemble the workflow for us on the Workflow Editor, providing configured nodes that are ready for execution.

In practice, it means clicking on any successfully executed node and asking K-AI to extend the workflow. In this example, we click on the “KPI computation” metanode and prompt K-AI to build the visualization we want based on the selected input data.

K-AI chat panel in Build mode and the selected node on the workflow.
Figure 4: K-AI chat panel in Build mode (on the left partof the screenshot) and the selected node on the workflow.

Throughout this blog post, we’ll use K-AI in the Build mode and gradually increase the complexity of our prompts. The ultimate goal is to visualize the revenue growth KPI using a bar chart with custom coloring and a juxtaposed line plot of the total monthly revenue. Here’s a step by step guide for how to reach that end result:

1. Create a basic bar chart

First ask K-AI for a basic bar chart to visualize monthly revenue growth.

Prompt: Generate a bar chart to display the monthly growth rate. Use the month number.

Result generated from K-AI with the  first prompt.In this visualization, the bars  represent the monthly revenue growth.
Figure 5: Result generated from K-AI with the first prompt.In this visualization, the bars represent the monthly revenue growth.

It’s interesting to notice that K-AI outputs a Generic ECharts View node, instead of a Bar Chart, which would have been fine in this case. This gives us a tiny sneak peek at the behind the scenes of how the LLM that powers K-AI works. It seems to prefer a node that can support JavaScript code to build visualizations, revealing the LLM’s extensive exposure to code during its training. 

2. Assign different colors according to bar length

In the second step, the goal is to encode the values of revenue growth in three different colors to better highlight the differences in the months. Enriching the prompt with this detail leads K-AI to output a Generic ECharts View node displaying the bar chart with the desired colors.

Prompt: Generate a bar chart to display the monthly growth rate. Use the month number. Associate to bars higher than 100 the color green, yellow between 100 and 0 and red if negative.

Result generated from K-AI with the  second prompt. Three different ranges of revenue  growth are encoded with three colors to highlight  the differences in the KPI.
Figure 6: Result generated from K-AI with the second prompt. Three different ranges of revenue growth are encoded with three colors to highlight the differences in the KPI. 

3. Display quantities on the bars

As the third step, we want to visualize the numerical values of revenue growth on top of each bar. For better readability, the value is rounded to one decimal place. Similarly to step two, we expand the prompt with this additional request.

Prompt: Generate a bar chart to display the monthly growth rate. Use the month number. Associate to bars higher than 100 the color green, yellow between 100 and 0 and red if negative. Add the labels to the growth rate (rounded to 1 digit). 

Result generated from K-AI with the third prompt. The percentage of the Revenue  Growth KPI for each month is shown rounded  to one digit.
Figure 7: Result generated from K-AI with the third prompt. The percentage of the Revenue Growth KPI for each month is shown rounded to one digit.

Prompting K-AI for the desired result leads to a successful visualization of the KPI in a matter of seconds. But we’re not done just yet.

This chart can be elaborated further, either by manually editing the generated JavaScript code in the Generic ECharts View node, or by requesting K-AI’s assistance again. We’ll go for the latter option.

4. Juxtapose a line plot to the bar chart

K-AI can provide additional assistance directly in the Generic ECharts View node. To access it, click on the node and the “Ask K-AI” bottom. This setting allows live manipulation of the graph, as well as the editing of existing features or the inclusion of new ones.

We ask K-AI to display a line plot with the sum of the revenue for each month on top of the existing bar chart. The visualization should also scale axes properly and display Revenue Growth on the y-axis on the left, and Total Revenue on the y-axis on the right. 

Prompt: Display the growth rate values legend (with its three possible colors: showing to which color the growth rate percentages correspond). After, superpose a blue line plot to display the sum(credit) for every month. Let the minimum of Total Credit be -10000.

 Final result generated with K-AI. This Plot includes both the bars representing the Revenue Growth and the line plot representing the total revenue in the corresponding month.
Figure 8: Final result generated with K-AI. This Plot includes both the bars representing the Revenue Growth and the line plot representing the total revenue in the corresponding month. 

Voilà, with few prompts, K-AI generates a fully customized visualization of our KPI, extending the possibilities of the out-of-the-box Bar Chart node and helping us communicate richer insights.

Note. Depending on the JavaScript code that K-AI generates, we may need to include a few additional prompts to properly display what you wish.

Visualizing a company’s KPIs has never been easier

In this blog post, we explored the power of K-AI in creating a customized visualization by simply typing a few prompts. We were able to generate interesting results with minimal effort, and combine two different plots, a bar chart and a line plot, in the same view. With the help of K-AI, the possibilities of customizing our data visualizations are almost endless.

Now it’s your turn to try. Interact with K-AI, let it help you build your dream visualizations, and display KPIs effectively to your stakeholders!