Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
14 views5 pages

Data Visualization Project

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

Data Visualization Project

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Exercise 1: Connecting and Processing Data

1. Download the data file: Sample-Superstore_Orders from the Practice Data


folder to your computer.
2. Connect the data to Power BI and load the following tables: sales_west,
sales_east, sales_central, sales_south, and returns.
3. In Power BI Desktop, go to Transform Data.
4. Perform data editing on the sales_east table:
4.1. Use the Data Profiling, Distribution, and Quality functions to check the
data.
4.2. Capitalize the first letter of the City column.
4.3. Add a new column Full name by combining First Name and Last Name.
5. Repeat the same steps for the tables sales_west, sales_central, sales_south.
6. Append the 4 sales tables into one table called sales_orders.
7. Perform data editing on the sales_orders table:
7.1. Replace values in the State column: AZ → Arizona, CA → California, CO
→ Colorado, ID → Idaho, MT → Montana, NM → New Mexico, OR → Oregon,
UT → Utah, WA → Washington.
7.2. Rename columns using lowercase and hyphens (e.g., full_name).
7.3. Change the data type of the Order Date column to Date.
8. Perform data editing on the returns table:
8.1. Split the Notes column into “Notes” and “Approved,” using “-” as the
delimiter.
8.2. Rename the column before “-” to Return Notes, and the part after “-” to
Approval By.
Exercise 2: Creating a Data Model:
1. From the file used in Exercise 1, load additional tables: product, regions,
customers into Power BI.
2. Go to Model View and set up the data model as shown in the provided diagram.
Exercise 3: Create a dim_date Table Using M Code
1. Open the Power BI file from Exercise 2 that you previously worked on, then go
to Transform Data.
2. Create a Blank Query.
3. Open the Advanced Editor and paste the following M code inside:
let
Today = DateTime.Date(DateTime.LocalNow()),
StartDate = #date(2018, 1, 1),
Step = Duration.Days(Today - StartDate),

Source = List.Dates(StartDate,Step, #duration(1,0,0,0)),


#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null,
ExtraValues.Error),

#"Inserted Year" = Table.AddColumn(#"Converted to Table", "Year", each


Date.Year([Column1]), Int64.Type),
#"Inserted Quarter" = Table.AddColumn(#"Inserted Year", "Quarter", each "Q" &
Text.From(Date.QuarterOfYear([Column1]))),
#"Inserted Month" = Table.AddColumn(#"Inserted Quarter", "Month", each
Date.Month([Column1]), Int64.Type),
#"Inserted Month Name" = Table.AddColumn(#"Inserted Month", "Month Name",
each Text.Start(Date.MonthName([Column1]),3), type text),
#"Inserted Week of Year" = Table.AddColumn(#"Inserted Month Name", "Week of
Year", each Date.WeekOfYear([Column1]), Int64.Type),
#"Inserted Day of Week" = Table.AddColumn(#"Inserted Week of Year", "Day of
Week", each Date.DayOfWeek([Column1]), Int64.Type),
#"Inserted Day Name" = Table.AddColumn(#"Inserted Day of Week", "Day Name",
each Text.Start(Date.DayOfWeekName([Column1]),3), type text),
// Add Fiscal Year based on month-end is June
#"Inserted Fiscal Year" = Table.AddColumn(#"Inserted Day Name", "Fiscal Year",
each if [Month] <= 6 then [Year] else [Year]+1),
// Add Month Sort for fiscal year
#"Inserted Month Fiscal Sort" = Table.AddColumn(#"Inserted Fiscal Year", "Month
Fiscal Sort", each if [Month] = 6 then [Month] +6 else [Month] – 6),
// Add working date
#"Inserted Working Date" = Table.AddColumn(#"Inserted Month Fiscal Sort",
"Working Date", each if [Day Name] = "Sun" then "No" else "Yes"),
// Rename and Change Type
#"Renamed Columns" = Table.RenameColumns(#"Inserted Working
Date",{{"Column1", "Date"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date",
type date}})
in
#"Changed Type"

Check and correct any errors so that the data can be successfully loaded.
4. Read and understand the M code to learn how it works.
5. Load the data into Power Pivot → go to Model View and set up the data model
by linking the newly created dim_date table to the sales_orders table.
6. Create bar and line charts to display profit over time, allowing analysis by
month, quarter, and year.

Exercise 4: Create Calculation Functions

1. Create a measure to calculate Total Sales based on the Sales column:

Tong doanh so = CALCULATE(SUM(sales_orders[Sales]))

2. Create a measure to calculate the Total Number of Orders:

Tong don hang = DISTINCTCOUNT(sales_orders[Order ID])

3. Create a measure to calculate Total Profit from the sales_orders table:

Tong loi nhuan = SUM(sales_orders[Profit])

4. Create a measure to calculate the Total Quantity of Products:

Tong so san pham = SUM(sales_orders[Quantity])

5. Create a measure to calculate Total Sales in the Same Period Last Year:

Tong doanh thu nam truoc =


CALCULATE(
[Tong doanh so],
SAMEPERIODLASTYEAR(dim_date[Date])
)
6. Create a measure to calculate the Revenue Growth Rate vs. the Same Period Last
Year:

ty le tang truong =
DIVIDE(
[Tong doanh so] - [Tong doanh thu nam truoc],
[Tong doanh thu nam truoc],
1
)

7. Calculate the Number of Customers who made purchases.


8. Calculate the Cumulative Number of Customers (Current Year).
9. Calculate the Cumulative Number of Customers (Previous Year).

Exercise 5: Calculate the Following KPIs


1. Create a measure to calculate Profit from the last 3 months using
DATESINPERIOD.
2. Create a measure to calculate Profit from the last 3 months using
DATEBETWEEN.
3. Create a measure to calculate the 3-Month Average Revenue to monitor sales
trends.

Exercise 6: Visualization & final report

You might also like