blob: eb6727311e4083d8479b5056c12446df9ba9876a [file] [log] [blame]
<!doctype html>
<html lang="en" dir="ltr" class="docs-wrapper docs-doc-page docs-version-current plugin-docs plugin-id-default docs-doc-id-creating-charts-dashboards/exploring-data">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v2.3.1">
<title data-rh="true">Exploring Data in Superset | Superset</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://superset.apache.org/docs/creating-charts-dashboards/exploring-data"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="Exploring Data in Superset | Superset"><meta data-rh="true" name="description" content="Exploring Data in Superset"><meta data-rh="true" property="og:description" content="Exploring Data in Superset"><link data-rh="true" rel="icon" href="/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://superset.apache.org/docs/creating-charts-dashboards/exploring-data"><link data-rh="true" rel="alternate" href="https://superset.apache.org/docs/creating-charts-dashboards/exploring-data" hreflang="en"><link data-rh="true" rel="alternate" href="https://superset.apache.org/docs/creating-charts-dashboards/exploring-data" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://WR5FASX5ED-dsn.algolia.net" crossorigin="anonymous"><link rel="preconnect" href="https://www.google-analytics.com">
<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","G-133LHD3B3N","auto"),ga("set","anonymizeIp",!0),ga("send","pageview")</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
<link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-133LHD3B3N"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-133LHD3B3N",{anonymize_ip:!0})</script>
<link rel="search" type="application/opensearchdescription+xml" title="Superset" href="/opensearch.xml">
<script src="/script/matomo.js"></script>
<script src="https://www.bugherd.com/sidebarv2.js?apikey=enilpiu7bgexxsnoqfjtxa" async></script><link rel="stylesheet" href="/assets/css/styles.574a8f44.css">
<link rel="preload" href="/assets/js/runtime~main.508e0599.js" as="script">
<link rel="preload" href="/assets/js/main.633857fa.js" as="script">
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/superset-logo-horiz.svg" alt="Superset Logo" class="themedImage_ToTc themedImage--light_HNdA"><img src="/img/superset-logo-horiz-dark.svg" alt="Superset Logo" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">Documentation</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/docs/intro">Getting Started</a></li><li><a class="dropdown__link" href="/docs/frequently-asked-questions">FAQ</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">Community</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/community">Resources</a></li><li><a href="https://github.com/apache/superset" target="_blank" rel="noopener noreferrer" class="dropdown__link">GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="http://bit.ly/join-superset-slack" target="_blank" rel="noopener noreferrer" class="dropdown__link">Slack<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://lists.apache.org/list.html?dev@superset.apache.org" target="_blank" rel="noopener noreferrer" class="dropdown__link">Mailing List<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://stackoverflow.com/questions/tagged/superset+apache-superset" target="_blank" rel="noopener noreferrer" class="dropdown__link">Stack Overflow<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><a href="https://github.com/apache/superset" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link" class="github-logo-container"></a><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/intro">Introduction</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/installation/installing-superset-using-docker-compose">Installation and Configuration</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/databases/installing-database-drivers">Connecting to Databases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/docs/creating-charts-dashboards/creating-your-first-dashboard">Creating Charts and Dashboards</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/creating-charts-dashboards/creating-your-first-dashboard">Creating Your First Dashboard</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/docs/creating-charts-dashboards/exploring-data">Exploring Data in Superset</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/miscellaneous/country-map-tools">Miscellaneous</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/docs/contributing/contributing-page">Contributing</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/frequently-asked-questions">Frequently Asked Questions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/api">API</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/security">Security</a></li></ul></nav></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_YNFT"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Creating Charts and Dashboards</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Exploring Data in Superset</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><h2 class="anchor anchorWithStickyNavbar_LWe7" id="exploring-data-in-superset">Exploring Data in Superset<a href="#exploring-data-in-superset" class="hash-link" aria-label="Direct link to Exploring Data in Superset" title="Direct link to Exploring Data in Superset"></a></h2><p>In this tutorial, we will introduce key concepts in Apache Superset through the exploration of a
real dataset which contains the flights made by employees of a UK-based organization in 2011. The
following information about each flight is given:</p><ul><li>The traveller’s department. For the purposes of this tutorial the departments have been renamed
Orange, Yellow and Purple.</li><li>The cost of the ticket.</li><li>The travel class (Economy, Premium Economy, Business and First Class).</li><li>Whether the ticket was a single or return.</li><li>The date of travel.</li><li>Information about the origin and destination.</li><li>The distance between the origin and destination, in kilometers (km).</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="enabling-data-upload-functionality">Enabling Data Upload Functionality<a href="#enabling-data-upload-functionality" class="hash-link" aria-label="Direct link to Enabling Data Upload Functionality" title="Direct link to Enabling Data Upload Functionality"></a></h3><p>You may need to enable the functionality to upload a CSV or Excel file to your database. The following section
explains how to enable this functionality for the examples database.</p><p>In the top menu, select <strong>Data ‣ Databases</strong>. Find the <strong>examples</strong> database in the list and
select the <strong>Edit</strong> button.</p><img loading="lazy" src="/img/tutorial/edit-record.png" class="img_ev3q"><p>In the resulting modal window, switch to the <strong>Extra</strong> tab and
tick the checkbox for <strong>Allow Data Upload</strong>. End by clicking the <strong>Save</strong> button.</p><img loading="lazy" src="/img/tutorial/add-data-upload.png" class="img_ev3q"><h3 class="anchor anchorWithStickyNavbar_LWe7" id="loading-csv-data">Loading CSV Data<a href="#loading-csv-data" class="hash-link" aria-label="Direct link to Loading CSV Data" title="Direct link to Loading CSV Data"></a></h3><p>Download the CSV dataset to your computer from
<a href="https://raw.githubusercontent.com/apache-superset/examples-data/master/tutorial_flights.csv" target="_blank" rel="noopener noreferrer">GitHub</a>.
In the Superset menu, select <strong>Data ‣ Upload a CSV</strong>.</p><img loading="lazy" src="/img/tutorial/upload_a_csv.png" class="img_ev3q"><p>Then, enter the <strong>Table Name</strong> as <em>tutorial_flights</em> and select the CSV file from your computer.</p><img loading="lazy" src="/img/tutorial/csv_to_database_configuration.png" class="img_ev3q"><p>Next enter the text <em>Travel Date</em> into the <strong>Parse Dates</strong> field.</p><img loading="lazy" src="/img/tutorial/parse_dates_column.png" class="img_ev3q"><p>Leaving all the other options in their default settings, select <strong>Save</strong> at the bottom of the page.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="table-visualization">Table Visualization<a href="#table-visualization" class="hash-link" aria-label="Direct link to Table Visualization" title="Direct link to Table Visualization"></a></h3><p>You should now see <em>tutorial_flights</em> as a dataset in the <strong>Datasets</strong> tab. Click on the entry to
launch an Explore workflow using this dataset.</p><p>In this section, we&#x27;ll create a table visualization
to show the number of flights and cost per travel class.</p><p>By default, Apache Superset only shows the last week of data. In our example, we want to visualize all
of the data in the dataset. Click the <strong>Time ‣ Time Range</strong> section and change
the <strong>Range Type</strong> to <strong>No Filter</strong>.</p><img loading="lazy" src="/img/tutorial/no_filter_on_time_filter.png" class="img_ev3q"><p>Click <strong>Apply</strong> to save.</p><p>Now, we want to specify the rows in our table by using the <strong>Group by</strong> option. Since in this
example, we want to understand different Travel Classes, we select <strong>Travel Class</strong> in this menu.</p><p>Next, we can specify the metrics we would like to see in our table with the <strong>Metrics</strong> option.</p><ul><li><code>COUNT(*)</code>, which represents the number of rows in the table
(in this case, quantity of flights in each Travel Class)</li><li><code>SUM(Cost)</code>, which represents the total cost spent by each Travel Class</li></ul><img loading="lazy" src="/img/tutorial/sum_cost_column.png" class="img_ev3q"><p>Finally, select <strong>Run Query</strong> to see the results of the table.</p><img loading="lazy" src="/img/tutorial/tutorial_table.png" class="img_ev3q"><p>To save the visualization, click on <strong>Save</strong> in the top left of the screen. In the following modal,</p><ul><li>Select the <strong>Save as</strong>
option and enter the chart name as Tutorial Table (you will be able to find it again through the
<strong>Charts</strong> screen, accessible in the top menu).</li><li>Select <strong>Add To Dashboard</strong> and enter
Tutorial Dashboard. Finally, select <strong>Save &amp; Go To Dashboard</strong>.</li></ul><img loading="lazy" src="/img/tutorial/save_tutorial_table.png" class="img_ev3q"><h3 class="anchor anchorWithStickyNavbar_LWe7" id="dashboard-basics">Dashboard Basics<a href="#dashboard-basics" class="hash-link" aria-label="Direct link to Dashboard Basics" title="Direct link to Dashboard Basics"></a></h3><p>Next, we are going to explore the dashboard interface. If you’ve followed the previous section, you
should already have the dashboard open. Otherwise, you can navigate to the dashboard by selecting
Dashboards on the top menu, then Tutorial dashboard from the list of dashboards.</p><p>On this dashboard you should see the table you created in the previous section. Select <strong>Edit
dashboard</strong> and then hover over the table. By selecting the bottom right hand corner of the table
(the cursor will change too), you can resize it by dragging and dropping.</p><img loading="lazy" src="/img/tutorial/resize_tutorial_table_on_dashboard.png" class="img_ev3q"><p>Finally, save your changes by selecting Save changes in the top right.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="pivot-table">Pivot Table<a href="#pivot-table" class="hash-link" aria-label="Direct link to Pivot Table" title="Direct link to Pivot Table"></a></h3><p>In this section, we will extend our analysis using a more complex visualization, Pivot Table. By the
end of this section, you will have created a table that shows the monthly spend on flights for the
first six months, by department, by travel class.</p><p>Create a new chart by selecting <strong>+ ‣ Chart</strong> from the top right corner. Choose
tutorial_flights again as a datasource, then click on the visualization type to get to the
visualization menu. Select the <strong>Pivot Table</strong> visualization (you can filter by entering text in the
search box) and then <strong>Create New Chart</strong>.</p><img loading="lazy" src="/img/tutorial/create_pivot.png" class="img_ev3q"><p>In the <strong>Time</strong> section, keep the Time Column as Travel Date (this is selected automatically as we
only have one time column in our dataset). Then select Time Grain to be month as having daily data
would be too granular to see patterns from. Then select the time range to be the first six months of
2011 by click on Last week in the Time Range section, then in Custom selecting a Start / end of 1st
January 2011 and 30th June 2011 respectively by either entering directly the dates or using the
calendar widget (by selecting the month name and then the year, you can move more quickly to far
away dates).</p><img loading="lazy" src="/img/tutorial/select_dates_pivot_table.png" class="img_ev3q"><p>Next, within the <strong>Query</strong> section, remove the default COUNT(<!-- -->*<!-- -->) and add Cost, keeping the default
SUM aggregate. Note that Apache Superset will indicate the type of the metric by the symbol on the
left hand column of the list (ABC for string, # for number, a clock face for time, etc.).</p><p>In <strong>Group by</strong> select <strong>Time</strong>: this will automatically use the Time Column and Time Grain
selections we defined in the Time section.</p><p>Within <strong>Columns</strong>, select first Department and then Travel Class. All set – let’s <strong>Run Query</strong> to
see some data!</p><img loading="lazy" src="/img/tutorial/tutorial_pivot_table.png" class="img_ev3q"><p>You should see months in the rows and Department and Travel Class in the columns. Publish this chart
to your existing Tutorial Dashboard you created earlier.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="line-chart">Line Chart<a href="#line-chart" class="hash-link" aria-label="Direct link to Line Chart" title="Direct link to Line Chart"></a></h3><p>In this section, we are going to create a line chart to understand the average price of a ticket by
month across the entire dataset.</p><p>In the Time section, as before, keep the Time Column as Travel Date and Time Grain as month but this
time for the Time range select No filter as we want to look at entire dataset.</p><p>Within Metrics, remove the default <code>COUNT(*)</code> metric and instead add <code>AVG(Cost)</code>, to show the mean value.</p><img loading="lazy" src="/img/tutorial/average_aggregate_for_cost.png" class="img_ev3q"><p>Next, select <strong>Run Query</strong> to show the data on the chart.</p><p>How does this look? Well, we can see that the average cost goes up in December. However, perhaps it
doesn’t make sense to combine both single and return tickets, but rather show two separate lines for
each ticket type.</p><p>Let’s do this by selecting Ticket Single or Return in the Group by box, and the selecting <strong>Run
Query</strong> again. Nice! We can see that on average single tickets are cheaper than returns and that the
big spike in December is caused by return tickets.</p><p>Our chart is looking pretty good already, but let’s customize some more by going to the Customize
tab on the left hand pane. Within this pane, try changing the Color Scheme, removing the range
filter by selecting No in the Show Range Filter drop down and adding some labels using X Axis Label
and Y Axis Label.</p><img loading="lazy" src="/img/tutorial/tutorial_line_chart.png" class="img_ev3q"><p>Once you’re done, publish the chart in your Tutorial Dashboard.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="markup">Markup<a href="#markup" class="hash-link" aria-label="Direct link to Markup" title="Direct link to Markup"></a></h3><p>In this section, we will add some text to our dashboard. If you’re there already, you can navigate
to the dashboard by selecting Dashboards on the top menu, then Tutorial dashboard from the list of
dashboards. Got into edit mode by selecting <strong>Edit dashboard</strong>.</p><p>Within the Insert components pane, drag and drop a Markdown box on the dashboard. Look for the blue
lines which indicate the anchor where the box will go.</p><img loading="lazy" src="/img/tutorial/blue_bar_insert_component.png" class="img_ev3q"><p>Now, to edit the text, select the box. You can enter text, in markdown format (see
<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank" rel="noopener noreferrer">this Markdown Cheatsheet</a> for
more information about this format). You can toggle between Edit and Preview using the menu on the
top of the box.</p><img loading="lazy" src="/img/tutorial/markdown.png" class="img_ev3q"><p>To exit, select any other part of the dashboard. Finally, don’t forget to keep your changes using
<strong>Save changes</strong>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="filter-box">Filter Box<a href="#filter-box" class="hash-link" aria-label="Direct link to Filter Box" title="Direct link to Filter Box"></a></h3><p>In this section, you will learn how to add a filter to your dashboard. Specifically, we will create
a filter that allows us to look at those flights that depart from a particular country.</p><p>A filter box visualization can be created as any other visualization by selecting <strong>+ ‣ Chart</strong>,
and then <em>tutorial_flights</em> as the datasource and Filter Box as the visualization type.</p><p>First of all, in the <strong>Time</strong> section, remove the filter from the Time range selection by selecting
No filter.</p><p>Next, in <strong>Filters Configurations</strong> first add a new filter by selecting the plus sign and then edit
the newly created filter by selecting the pencil icon.</p><p>For our use case, it makes most sense to present a list of countries in alphabetical order. First,
enter the column as Origin Country and keep all other options the same and then select <strong>Run
Query</strong>. This gives us a preview of our filter.</p><p>Next, remove the date filter by unchecking the Date Filter checkbox.</p><img loading="lazy" src="/img/tutorial/filter_on_origin_country.png" class="img_ev3q"><p>Finally, select <strong>Save</strong>, name the chart as Tutorial Filter, add the chart to our existing Tutorial
Dashboard and then Save &amp; go to dashboard. Once on the Dashboard, try using the filter to show only
those flights that departed from the United Kingdom – you will see the filter is applied to all of
the other visualizations on the dashboard.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="publishing-your-dashboard">Publishing Your Dashboard<a href="#publishing-your-dashboard" class="hash-link" aria-label="Direct link to Publishing Your Dashboard" title="Direct link to Publishing Your Dashboard"></a></h3><p>If you have followed all of the steps outlined in the previous section, you should have a dashboard
that looks like the below. If you would like, you can rearrange the elements of the dashboard by
selecting <strong>Edit dashboard</strong> and dragging and dropping.</p><p>If you would like to make your dashboard available to other users, simply select Draft next to the
title of your dashboard on the top left to change your dashboard to be in Published state. You can
also favorite this dashboard by selecting the star.</p><img loading="lazy" src="/img/tutorial/publish_dashboard.png" class="img_ev3q"><h3 class="anchor anchorWithStickyNavbar_LWe7" id="annotations">Annotations<a href="#annotations" class="hash-link" aria-label="Direct link to Annotations" title="Direct link to Annotations"></a></h3><p>Annotations allow you to add additional context to your chart. In this section, we will add an
annotation to the Tutorial Line Chart we made in a previous section. Specifically, we will add the
dates when some flights were cancelled by the UK’s Civil Aviation Authority in response to the
eruption of the Grímsvötn volcano in Iceland (23-25 May 2011).</p><p>First, add an annotation layer by navigating to Manage ‣ Annotation Layers. Add a new annotation
layer by selecting the green plus sign to add a new record. Enter the name Volcanic Eruptions and
save. We can use this layer to refer to a number of different annotations.</p><p>Next, add an annotation by navigating to Manage ‣ Annotations and then create a new annotation by
selecting the green plus sign. Then, select the Volcanic Eruptions layer, add a short description
Grímsvötn and the eruption dates (23-25 May 2011) before finally saving.</p><img loading="lazy" src="/img/tutorial/edit_annotation.png" class="img_ev3q"><p>Then, navigate to the line chart by going to Charts then selecting Tutorial Line Chart from the
list. Next, go to the Annotations and Layers section and select Add Annotation Layer. Within this
dialogue:</p><ul><li>Name the layer as Volcanic Eruptions</li><li>Change the Annotation Layer Type to Event</li><li>Set the Annotation Source as Superset annotation</li><li>Specify the Annotation Layer as Volcanic Eruptions</li></ul><img loading="lazy" src="/img/tutorial/annotation_settings.png" class="img_ev3q"><p>Select <strong>Apply</strong> to see your annotation shown on the chart.</p><img loading="lazy" src="/img/tutorial/annotation.png" class="img_ev3q"><p>If you wish, you can change how your annotation looks by changing the settings in the Display
configuration section. Otherwise, select <strong>OK</strong> and finally <strong>Save</strong> to save your chart. If you keep
the default selection to overwrite the chart, your annotation will be saved to the chart and also
appear automatically in the Tutorial Dashboard.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="advanced-analytics">Advanced Analytics<a href="#advanced-analytics" class="hash-link" aria-label="Direct link to Advanced Analytics" title="Direct link to Advanced Analytics"></a></h3><p>In this section, we are going to explore the Advanced Analytics feature of Apache Superset that
allows you to apply additional transformations to your data. The three types of transformation are:</p><p><strong>Setting up the base chart</strong></p><p>In this section, we’re going to set up a base chart which we can then apply the different <strong>Advanced
Analytics</strong> features to. Start off by creating a new chart using the same <em>tutorial_flights</em>
datasource and the <strong>Line Chart</strong> visualization type. Within the Time section, set the Time Range as
1st October 2011 and 31st October 2011.</p><p>Next, in the query section, change the Metrics to the sum of Cost. Select <strong>Run Query</strong> to show the
chart. You should see the total cost per day for each month in October 2011.</p><img loading="lazy" src="/img/tutorial/advanced_analytics_base.png" class="img_ev3q"><p>Finally, save the visualization as Tutorial Advanced Analytics Base, adding it to the Tutorial
Dashboard.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="rolling-mean">Rolling Mean<a href="#rolling-mean" class="hash-link" aria-label="Direct link to Rolling Mean" title="Direct link to Rolling Mean"></a></h3><p>There is quite a lot of variation in the data, which makes it difficult to identify any trend. One
approach we can take is to show instead a rolling average of the time series. To do this, in the
<strong>Moving Average</strong> subsection of <strong>Advanced Analytics</strong>, select mean in the <strong>Rolling</strong> box and
enter 7 into both Periods and Min Periods. The period is the length of the rolling period expressed
as a multiple of the Time Grain. In our example, the Time Grain is day, so the rolling period is 7
days, such that on the 7th October 2011 the value shown would correspond to the first seven days of
October 2011. Lastly, by specifying Min Periods as 7, we ensure that our mean is always calculated
on 7 days and we avoid any ramp up period.</p><p>After displaying the chart by selecting <strong>Run Query</strong> you will see that the data is less variable
and that the series starts later as the ramp up period is excluded.</p><img loading="lazy" src="/img/tutorial/rolling_mean.png" class="img_ev3q"><p>Save the chart as Tutorial Rolling Mean and add it to the Tutorial Dashboard.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="time-comparison">Time Comparison<a href="#time-comparison" class="hash-link" aria-label="Direct link to Time Comparison" title="Direct link to Time Comparison"></a></h3><p>In this section, we will compare values in our time series to the value a week before. Start off by
opening the Tutorial Advanced Analytics Base chart, by going to <strong>Charts</strong> in the top menu and then
selecting the visualization name in the list (alternatively, find the chart in the Tutorial
Dashboard and select Explore chart from the menu for that visualization).</p><p>Next, in the Time Comparison subsection of <strong>Advanced Analytics</strong>, enter the Time Shift by typing in
“minus 1 week” (note this box accepts input in natural language). Run Query to see the new chart,
which has an additional series with the same values, shifted a week back in time.</p><img loading="lazy" src="/img/tutorial/time_comparison_two_series.png" class="img_ev3q"><p>Then, change the <strong>Calculation type</strong> to Absolute difference and select <strong>Run Query</strong>. We can now
see only one series again, this time showing the difference between the two series we saw
previously.</p><img loading="lazy" src="/img/tutorial/time_comparison_absolute_difference.png" class="img_ev3q"><p>Save the chart as Tutorial Time Comparison and add it to the Tutorial Dashboard.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="resampling-the-data">Resampling the data<a href="#resampling-the-data" class="hash-link" aria-label="Direct link to Resampling the data" title="Direct link to Resampling the data"></a></h3><p>In this section, we’ll resample the data so that rather than having daily data we have weekly data.
As in the previous section, reopen the Tutorial Advanced Analytics Base chart.</p><p>Next, in the Python Functions subsection of <strong>Advanced Analytics</strong>, enter 7D, corresponding to seven
days, in the Rule and median as the Method and show the chart by selecting <strong>Run Query</strong>.</p><img loading="lazy" src="/img/tutorial/resample.png" class="img_ev3q"><p>Note that now we have a single data point every 7 days. In our case, the value showed corresponds to
the median value within the seven daily data points. For more information on the meaning of the
various options in this section, refer to the
<a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.resample.html" target="_blank" rel="noopener noreferrer">Pandas documentation</a>.</p><p>Lastly, save your chart as Tutorial Resample and add it to the Tutorial Dashboard. Go to the
tutorial dashboard to see the four charts side by side and compare the different outputs.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apache/superset/tree/master/docs/docs/creating-charts-dashboards/exploring-data.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/docs/creating-charts-dashboards/creating-your-first-dashboard"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Creating Your First Dashboard</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/docs/miscellaneous/country-map-tools"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Country Map Tools</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#exploring-data-in-superset" class="table-of-contents__link toc-highlight">Exploring Data in Superset</a><ul><li><a href="#enabling-data-upload-functionality" class="table-of-contents__link toc-highlight">Enabling Data Upload Functionality</a></li><li><a href="#loading-csv-data" class="table-of-contents__link toc-highlight">Loading CSV Data</a></li><li><a href="#table-visualization" class="table-of-contents__link toc-highlight">Table Visualization</a></li><li><a href="#dashboard-basics" class="table-of-contents__link toc-highlight">Dashboard Basics</a></li><li><a href="#pivot-table" class="table-of-contents__link toc-highlight">Pivot Table</a></li><li><a href="#line-chart" class="table-of-contents__link toc-highlight">Line Chart</a></li><li><a href="#markup" class="table-of-contents__link toc-highlight">Markup</a></li><li><a href="#filter-box" class="table-of-contents__link toc-highlight">Filter Box</a></li><li><a href="#publishing-your-dashboard" class="table-of-contents__link toc-highlight">Publishing Your Dashboard</a></li><li><a href="#annotations" class="table-of-contents__link toc-highlight">Annotations</a></li><li><a href="#advanced-analytics" class="table-of-contents__link toc-highlight">Advanced Analytics</a></li><li><a href="#rolling-mean" class="table-of-contents__link toc-highlight">Rolling Mean</a></li><li><a href="#time-comparison" class="table-of-contents__link toc-highlight">Time Comparison</a></li><li><a href="#resampling-the-data" class="table-of-contents__link toc-highlight">Resampling the data</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">Copyright © 2023,
The <a href="https://www.apache.org/" target="_blank" rel="noreferrer">Apache Software Foundation</a>,
Licensed under the Apache <a href="https://apache.org/licenses/LICENSE-2.0" target="_blank" rel="noreferrer">License</a>. <br>
<small>Apache Superset, Apache, Superset, the Superset logo, and the Apache feather logo are either registered trademarks or trademarks of The Apache Software Foundation. All other products or name brands are trademarks of their respective holders, including The Apache Software Foundation.
<a href="https://www.apache.org/" target="_blank">Apache Software Foundation</a> resources</small><br>
<small>
<a href="https://www.apache.org/security/" target="_blank" rel="noreferrer">Security</a>&nbsp;|&nbsp;
<a href="https://www.apache.org/foundation/sponsorship.html" target="_blank" rel="noreferrer">Donate</a>&nbsp;|&nbsp;
<a href="https://www.apache.org/foundation/thanks.html" target="_blank" rel="noreferrer">Thanks</a>&nbsp;|&nbsp;
<a href="https://apache.org/events/current-event" target="_blank" rel="noreferrer">Events</a>&nbsp;|&nbsp;
<a href="https://apache.org/licenses/" target="_blank" rel="noreferrer">License</a>
</small></div></div></div></footer></div>
<script src="/assets/js/runtime~main.508e0599.js"></script>
<script src="/assets/js/main.633857fa.js"></script>
</body>
</html>