Monday, 6 July 2026

How to Build a Big Number with Trend Line Chart in Apache Superset?

  

In modern analytics, decision-makers don’t just want raw numbers—they want quick insights with context. A single KPI is useful, but combining it with a trend over time makes it far more powerful.

 

In this guide, we’ll walk through how to create a Big Number with Trend Line chart in Apache Superset, using a custom dataset.

 

Let's use following Website Traffic for the demo.

visit_date,page,traffic_source,visitors
2024-01-01,Home,Google,1200
2024-01-01,Home,Direct,800
2024-01-02,Product,Google,950
2024-01-02,Product,Facebook,600
2024-01-03,Checkout,Direct,400
2024-01-03,Checkout,Google,700
2024-01-04,Home,Facebook,500
2024-01-04,Product,Direct,650

Here:

·      visit_date: Specifies the day when users visited your website

·      page: The specific page on your website that the user visited

·      traffic_source: Where the user came from before visiting your site

·      visitors: Number of users who visited that page from that source on that date

 

Each row represents number of visitors for a specific combination of date + page + traffic source.

 

website-traffic.csv

visit_date,page,traffic_source,visitors
2026-05-04,Home,Google,1320
2026-05-04,Product,Direct,870
2026-05-04,Checkout,Facebook,430
2026-05-03,Home,Direct,910
2026-05-03,Product,Google,1020
2026-05-03,Checkout,Google,510
2026-05-02,Home,Facebook,780
2026-05-02,Product,Direct,640
2026-05-02,Checkout,Google,590
2026-05-01,Home,Google,1250
2026-05-01,Product,Facebook,720
2026-05-01,Checkout,Direct,410
2026-04-30,Home,Direct,890
2026-04-30,Product,Google,980
2026-04-30,Checkout,Facebook,460
2026-04-29,Home,Google,1340
2026-04-29,Product,Direct,760
2026-04-29,Checkout,Google,520
2026-04-28,Home,Facebook,800
2026-04-28,Product,Google,1010
2026-04-28,Checkout,Direct,390
2026-04-27,Home,Direct,870
2026-04-27,Product,Facebook,710
2026-04-27,Checkout,Google,540
2026-04-26,Home,Google,1280
2026-04-26,Product,Direct,690
2026-04-26,Checkout,Facebook,420
2026-04-25,Home,Direct,920
2026-04-25,Product,Google,990
2026-04-25,Checkout,Google,560
2026-04-24,Home,Facebook,760
2026-04-24,Product,Direct,650
2026-04-24,Checkout,Google,600
2026-04-23,Home,Google,1310
2026-04-23,Product,Facebook,740
2026-04-23,Checkout,Direct,400
2026-04-22,Home,Direct,880
2026-04-22,Product,Google,970
2026-04-22,Checkout,Facebook,450
2026-04-21,Home,Google,1290
2026-04-21,Product,Direct,720
2026-04-21,Checkout,Google,530
2026-04-20,Home,Facebook,790
2026-04-20,Product,Google,1000
2026-04-20,Checkout,Direct,380
2026-04-19,Home,Direct,860
2026-04-19,Product,Facebook,700
2026-04-19,Checkout,Google,550
2026-04-18,Home,Google,1270
2026-04-18,Product,Direct,680
2026-04-18,Checkout,Facebook,410
2026-04-17,Home,Direct,930
2026-04-17,Product,Google,995
2026-04-17,Checkout,Google,570
2026-04-16,Home,Facebook,770
2026-04-16,Product,Direct,660
2026-04-16,Checkout,Google,610
2026-04-15,Home,Google,1305
2026-04-15,Product,Facebook,735
2026-04-15,Checkout,Direct,405
2026-04-14,Home,Direct,875
2026-04-14,Product,Google,965
2026-04-14,Checkout,Facebook,455
2026-04-13,Home,Google,1335
2026-04-13,Product,Direct,745
2026-04-13,Checkout,Google,515
2026-04-12,Home,Facebook,805
2026-04-12,Product,Google,1005
2026-04-12,Checkout,Direct,395
2026-04-11,Home,Direct,865
2026-04-11,Product,Facebook,705
2026-04-11,Checkout,Google,545
2026-04-10,Home,Google,1265
2026-04-10,Product,Direct,675
2026-04-10,Checkout,Facebook,415
2026-04-09,Home,Direct,940
2026-04-09,Product,Google,985
2026-04-09,Checkout,Google,575
2026-04-08,Home,Facebook,775
2026-04-08,Product,Direct,665
2026-04-08,Checkout,Google,605
2026-04-07,Home,Google,1315
2026-04-07,Product,Facebook,725
2026-04-07,Checkout,Direct,420
2026-04-06,Home,Direct,885
2026-04-06,Product,Google,975
2026-04-06,Checkout,Facebook,465
2026-04-05,Home,Google,1325
2026-04-05,Product,Direct,755
2026-04-05,Checkout,Google,525

   

Follow below step-by-step procedure to design a Big Number with trend line chart.

 

Step 1: Upload website-traffic.csv to Superset.

 

Data -> Upload CSV to database

 


·      Upload the file website-traffic.csv

·      Choose the database and schema where you want to upload the csv file.

·      Set the table name as website-traffic.

  


Expand Columns section, select all the columsn and add following data to Column Data types section

 

{
  "visit_date": "datetime64[ns]",
  "page": "string",
  "traffic_source": "string",
  "visitors": "int64"
}


 

Click on Upload button to create the dataset.

 

Navigate to Datasets listing page, you can see that website-traffic dataset is created and shown.

 

Step 2: Write Custom SQL Query.

 

We want:

 

·      A time-series dataset

·      Aggregated daily total visitors

·      Clean structure for Big Number + Trend Line

 

Open SQL -> SQL Lab.

 

Select website-traffic table and paste following query in SQL Editor and run the query.

SELECT 
  DATE(visit_date) AS traffic_date,
  SUM(visitors) AS total_visitors
FROM 'website-traffic'
WHERE DATE(visit_date) >= CURRENT_DATE - INTERVAL '30 days'
GROUP BY traffic_date
ORDER BY traffic_date;

You will see following result.


 

Click on Save -> Save dataset.

 


Give the dataset name as ‘website traffic count with trend line’ and click on ‘Save & Explore’ button.

 


Step 3: Create Chart.

 

You will be navigated to Chart Configuration screen.

 


Click on ‘View all charts’ link.

 

Select ‘Big Number with Trendline’.

 


 

Now we need to configure our Big Number with Trendline chart.

 

Select traffic_date for the X-axis to instruct Apache Superset to use this field for time-based analysis and trend calculations.

 

Next, define the metric to be displayed as the primary value. In the Metrics section, drag and drop the total_visitors column and keep the aggregation set to SUM so that the chart reflects the total visitor count.

 


Click on Save button, and click on ‘Update chart’ button, you can see the chart like below.



  

In Apache Superset, the Big Number with Trend Line:

 

·      Big Number (2.62K), shows the latest value (based on the most recent date in your data)

·      Trend Line shows the historical trend over time

 

The key advantage of the big number with trend line chart is that it automatically adds a compact line chart to illustrate how your metric evolves over time.

 

As you configure the metric, you’ll see a prominent value representing your key performance indicator, along with a subtle trend line that highlights its historical movement.

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment