Pizza Sales Project with Power BI
Introduction
Welcome to my first project using Power BI!
A month ago, I analyzed the Pizza Sales dataset from Kaggle by creating SQL quieries; you can check out that post here. However, this time, I will analyze the same dataset by creating visuals instead of queries.
Connecting the Data
Because I previously used a SQL database to analyze the pizza sales, I'm going to connect that database into a Power BI report.
So, I will click on "Get Data" on the home ribbon and click on the "PostgresSQL database" button, like so:
Then, I put the SQL server and database name:
After that, I got this pop-up window:
Usually I would click on "Transform data" but because I already cleaned the data in the SQL database, I will just click on "Load".
Data Model
I don't have to make any changes in the data model. Looking at the image, this is a pretty simple project and there is only one table involved, so there isn't any relationships that need to be established:
So, I can now dive into creating visuals for this dataset. However, before I do that, I'm going to revisit the statistical questions that I used in the SQL post:
Statistical Questions
- What days and times do we tend to be busiest?
- What are our best and worst-selling pizzas?
- What's our average order value?
I'm going to be showing you a visual that answers each statistical question, and after that, I will show you what my report looks like as a whole.
Statistical Question 1: What days and times do we tend to be busiest?
I need to use DAX in order to answer this question. There's a DAX function called HOUR that retrieves all the hours from timestamps. So, here's what I did.
I have a column called "order_time" that has all the timestamps of when each pizza was ordered. This is what the code looks like:
Then, I created a simple bar chart that shows the relationship between the hour and the quantity of pizzas sold:
Looking at the chart, the busiest time for this fictional pizza business is the 12th hour, which is noon.
I also need to show what the busiest day for the business is. To do this, we need to use more DAX!
I created a new column using the DAX function callled WEEKDAY:
This basically returns integers from the dates in the column called "order_date". The integers range from 1 to 7 with 1 representing "Sunday" and 7 representing "Saturday". However, I want to convert these integers to the actual days of the week, so I will have to use another DAX function called IF:
Here, I created a new column that contains the actual names of the days of the week based on the numbers from 1 to 7.
This bar chart shows that Fridays, Saturdays, and Sundays sell the most pizzas.
Statistical Question 2: What are our best and worst-selling pizzas?
BEST SELLING PIZZAS To answer this question on Power BI, I used the "pizza_name" and "quantity" column. Because there are many values in the "pizza_name", I used a filter to only show the 5 pizzas that are sold the most. This would reduce clutter in the bar chart.
Here's what the visual looks like:
There doesn't seem to be much difference in the number of pizzas sold for the top 5 types. Nevertheless, based on the chart, "Classic Deluxe Pizza" seems to be the popular choice among the customers.
WORST SELLING PIZZAS I used a filter again, but this time, I filtered the bottom 5 pizzas sold.
Here's how it looks:
The "Brie Carre Pizza" seems to be the least popular pizza in the business with only 490 of them being sold.
Statistical Question 3: What's our average order value?
I'm going to find the average price for the pizzas based on the size. So, I'm going to use the "pizza_size" and "total_price" column to answer this question.
I made a treemap:
Not surprisingly, the bigger the size of the pizza, the more expensive the average price is. The XXL pizza size has the most expensive average price of $35.95.
The Final Report
I played around in the Power BI Report and polished the visuals that I showed above and did my best to make it visually appealing:
Conclusion
Thank you for reading this post! I hope you enjoyed it. If you want to see my other content related to Power BI, check out this previous post.