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

Data Processing and Visualization Guide

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)
17 views5 pages

Data Processing and Visualization Guide

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

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 = [Link]([Link]()),
StartDate = #date(2018, 1, 1),
Step = [Link](Today - StartDate),

Source = [Link](StartDate,Step, #duration(1,0,0,0)),


#"Converted to Table" = [Link](Source, [Link](), null, null,
[Link]),

#"Inserted Year" = [Link](#"Converted to Table", "Year", each


[Link]([Column1]), [Link]),
#"Inserted Quarter" = [Link](#"Inserted Year", "Quarter", each "Q" &
[Link]([Link]([Column1]))),
#"Inserted Month" = [Link](#"Inserted Quarter", "Month", each
[Link]([Column1]), [Link]),
#"Inserted Month Name" = [Link](#"Inserted Month", "Month Name",
each [Link]([Link]([Column1]),3), type text),
#"Inserted Week of Year" = [Link](#"Inserted Month Name", "Week of
Year", each [Link]([Column1]), [Link]),
#"Inserted Day of Week" = [Link](#"Inserted Week of Year", "Day of
Week", each [Link]([Column1]), [Link]),
#"Inserted Day Name" = [Link](#"Inserted Day of Week", "Day Name",
each [Link]([Link]([Column1]),3), type text),
// Add Fiscal Year based on month-end is June
#"Inserted Fiscal Year" = [Link](#"Inserted Day Name", "Fiscal Year",
each if [Month] <= 6 then [Year] else [Year]+1),
// Add Month Sort for fiscal year
#"Inserted Month Fiscal Sort" = [Link](#"Inserted Fiscal Year", "Month
Fiscal Sort", each if [Month] = 6 then [Month] +6 else [Month] – 6),
// Add working date
#"Inserted Working Date" = [Link](#"Inserted Month Fiscal Sort",
"Working Date", each if [Day Name] = "Sun" then "No" else "Yes"),
// Rename and Change Type
#"Renamed Columns" = [Link](#"Inserted Working
Date",{{"Column1", "Date"}}),
#"Changed Type" = [Link](#"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

Common questions

Powered by AI

Calculated measures like Total Sales and Revenue Growth Rate enhance analytical capabilities by providing dynamic and interactive measures that can be used in various visualizations to derive insights. For example, Total Sales allows a quick assessment of overall financial performance, while Revenue Growth Rate provides insights into business trends and helps identify areas of growth or concern. These measures support deeper analysis and facilitate better strategic planning based on quantitative data .

The M code facilitates financial reporting by systematically generating a date table that includes fiscal year calculations. It dynamically computes fiscal years by adding a fiscal year column, where months from January to June are considered part of the current year, and months from July to December are considered part of the next fiscal year. This is crucial for financial reporting as it aligns data analysis with fiscal periods rather than calendar years, ensuring insights are relevant for financial decision-making .

Cumulative customer measures add significant value to sales analytics by allowing businesses to track customer growth over time and assess customer retention and acquisition trends. This type of analysis is crucial for understanding customer lifetime value and improving customer strategies. These insights can guide marketing efforts and influence operational decisions to enhance business growth and customer satisfaction .

Challenges in using Power BI's Advanced Editor and M code include potential syntax errors, difficulty in debugging complex queries, and ensuring that transformations align with business rules. These can be addressed by gaining a thorough understanding of M code syntax and functionality, using systematic debugging techniques such as breaking down code into smaller parts, and continuously testing transformations to ensure they meet analytical needs .

The benefits of using Data Profiling, Distribution, and Quality functions include enhanced understanding of the dataset's structure and characteristics, such as identifying possible quality issues like missing or duplicate records, and understanding value distributions across columns which can point to anomalies or patterns. These insights are essential for making informed decisions on further data transformations and ensuring data accuracy and reliability for analytical processes .

Column transformations, including renaming and data type changes, play a crucial role in data analysis and reporting by ensuring that data is easily understandable and formats are suitable for calculations and visualizations. Renaming columns to a consistent style, such as using lowercase and hyphens, improves readability and conformity to naming conventions. Changing data types, like converting text dates to 'Date' types, is essential for accurate time-based analysis and aggregations .

Implementing financial KPIs with Power BI's advanced functionalities supports business decision-making by offering real-time insights into key performance aspects such as profit trends, revenue growth, and customer metrics. KPIs provide a clear and concise indication of business health, enabling swift reaction to financial changes. Power BI allows these KPIs to be visually represented, monitored, and drilled into for deeper analysis, thereby enhancing strategic decision-making and operational efficiency .

Date-based visualizations are critical for sales analysis as they allow users to track trends over time, understand seasonal variations, and perform period comparisons. Power BI enhances this process with its ability to create dynamic charts like bar and line charts, which provide users with interactive ways to analyze sales data by different time units such as month, quarter, and year, facilitating deeper insights and timely decision-making .

Critical considerations when setting up a data model include understanding relationships between tables, ensuring data integrity with accurate keys for linking tables, and maintaining efficient data storage and query performance. The Power BI model view facilitates this process by visually representing the tables and their relationships, allowing for easy adjustments and optimizations, ensuring the data model supports accurate and performant analytics .

The steps involve connecting and loading the sales tables (sales_west, sales_east, sales_central, and sales_south) into Power BI and performing data editing on each one. This includes using Data Profiling to check data quality, capitalizing the first letter of the City column, and adding a new column for Full Name by combining First Name and Last Name. Once the individual tables are prepared, they are appended into one table called sales_orders. Further transformations are performed on sales_orders like replacing state abbreviations with full names, renaming columns using lowercase and hyphens, and changing the data type of Order Date to Date . Consistency in data format is crucial for accurate data analysis and reporting, ensuring uniformity and reducing errors when aggregating data from multiple sources.

You might also like