Get startedGet started for free

Building first visualizations in Databricks

1. Create a Bar Chart

Let's dive into a demonstration using the TPCH sample dataset, which consists of 8 tables and is available in Databricks itself. We'll focus on the 'orders' table, which contains sales data such as order price and date for each order. We start by opening the 'SQL Editor' from the sidebar. We enter a query and save it as "1_1_demo". This query calculates the total price for each order and identifies the month in which the orders were made. This will set the stage for our visual exploration. Now, we need to turn on our SQL cluster. Once the cluster is turned on, we can run the query by clicking the "Run" button. You'll see the raw results, including columns for the total price of each order and the order month. This data will be our foundation for creating meaningful visualizations. Next, let's create a bar chart. Bar charts are helpful when we want to compare the frequency of occurrences of different categories in your dataset. Click the "+" icon next to the "Raw results,"" select Visualization," and click it. A new card will open automatically, and we can set our visualization. Now we choose the Visualization type as "Bar". We will choose "Order_Month" as the X column. For the Y column, select "*" and set the aggregation type to "Count." This will give us the count of rows. Now, we see a preview on the right showing the order counts by month. February has the fewest orders. This visualization quickly shows which months are busier and quieter. Next, click "Save" to add the visualization to our main window. To make further adjustments, click the down arrow on the visualization title and select "Edit." You can also rename the chart to better reflect its content. For example, "Monthly Order Count" can be a more descriptive. To rename this chart, click the visualization name and enter a new name. Similarly, we can add another new visualization. This time, let's add a line chart. Again, click the "+" icon next to the "Raw results", select "Visualization", and choose "Line" as the visualization type. Select "Order_Month" for the X column and the sum of "Total_Price" for the Y column. We can also change the title of the line chart by editing the top row in the card above the visualization type. This line chart will help us track how the total price of orders changes over the months. Notice in the preview that February has the lowest total price, while July has the highest. As you have noticed, Line charts connect different data points through straight lines and help analyze trends over time, with time typically displayed on the X-axis and the metric of interest on the Y-axis. You can add and customize other visualizations similarly. Each chart type offers unique insights and helps tell a different part of the story. That's it for now. Let's explore some basic charts together in the exercises.

2. Let's practice!