Context
An art dealer friend, who has multiple sales representatives who sell various products across four different states in the US, likes to use the data he has collected to make insight-driven decisions.
Objective
Dealer wants to understand the sales performance across various products over the last three years
Strategies
1. Combine sales data from multiple CSV files and add product and sales rep data to the data model
2. Create a date table with a column for the last day of each month for the purpose of conducting time-based analysis
3. Establish relationships between sales rep, product, sales, and date tables
4. Calculate total net sales excluding discounts
5. Create a pivot table showing total sales and YOY% change for regions, excluding subtotals and individual regions
Author: Anthony Mok
Date: 18 Nov 2023
Email: xxiaohao@yahoo.com
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
Using DAX & Time-based Analysis in Data Warehouse
1. USING DAX & TIME-BASED
ANALYSIS IN DATA WAREHOUSE
Understand Sales Performance Across
Various Products Over Last ThreeYears
Author: Anthony Mok
Date: 18 Nov 2023
Email: xxiaohao@yahoo.com
2. WHAT ARE...?
Data Analysis Expressions (DAX)
A formula language used in Power Pivot in Excel.
It allows users to create custom calculations for
calculated columns and measures
Time-based Analysis
Used to make informed business
decisions by identifying trends,
patterns, and anomalies in data
Measures
Are calculated fields that are used to perform
aggregations and calculations on data.They are
used in PivotTables and PivotCharts to
summarise and analyse data
3. PROJECT’S CONTEXT, OBJECTIVE & STRATEGIES
Context
An art dealer friend, who has multiple
sales representatives who sell various
products across four different states in the
US, likes to use the data he has collected to
make insight-driven decisions
Strategies
• Combine sales data from multiple CSV files and add
product and sales rep data to the data model
• Create a date table with a column for the last day of
each month for the purpose of conducting time-based
analysis
• Establish relationships between sales rep, product,
sales, and date tables
• Calculate total net sales excluding discounts
• Create a pivot table showing total sales andYOY%
change for regions, excluding subtotals and individual
regions
Objective
Dealer wants to understand the
sales performance across
various products over the last
three years
4. CREATE & ADD DATA MODEL TO POWER PIVOT
▪ .csv files for ‘Sales 21’,‘Sales 22’ and
‘Sales 23’ were imported Power
Query
▪ These were combined into a single
file:‘Merged Sales 2021-2023’
▪ Together with the ‘Product’ and
‘Sales Rep’Tables, from the ‘Product
and SalesRep.xlsx’ file, these are
added to the data model in Power
Pivot
5. MORE DATA MODELS & USING DAX FORMULAE*
▪ To prepare the data model for time-
based analysis, new table, which dates
ranged from 01 January 2021 to 31
December 2023, was created in Power
Pivot
▪ The new date table was renamed as
‘Date’
▪ An additional column, with the last day of
the month for any given month, was
created in this table
▪ DAX formulae used to create this column:
EOM:=FORMAT(EOMONTH('Date'[Date], 0),
"dd/mm/yyyy”
▪ This new column was renamed as ‘EOM’
* This is one of many DAX created in this project. The rest could be found
in the report, which the Art Dealer has requested not to be released
6. FINALISING DATA MODEL WITH RELATIONSHIPS
▪ The relationships between the ‘Sales
Rep’,‘Product’,‘Sales’ and ‘Date’
tables were created after examining
their for their common key across
tables.
▪ ‘Date’,‘ProductID’ and ‘SalesRepID’
are the keys used to connect the
tables to create the final data model
7. GENERATING MEASURES* IN POWER PIVOT
Measure to get the ‘Total Net Sales’ was created from the ‘Merged Sales 2021-2023’ Table in Power Pivot:
Steps
▪ Inserted a column between ‘SalesRepID’ and the ‘Units’ columns, and use the Power Pivot DAX’s “RELATED()” function to bring the data
from the ‘Price’ column, in the ‘Product’ Table, into the ‘Merged Sales 2021-2023’ Table
▪ Created two additional columns in the ‘Merged Sales 2021-2023 Table to store the calculated ‘Total Discount’ and ‘Sales’ data
▪ Created the measure for “Net Sales = Total Sales – Discounts”, the “Sum of Total Discount” and the “Sum of Sales”, and these were
formulated and formatted into Singapore Dollars
▪ Finally, the ‘Net Sales’ or ‘Sum of Net Sales’ were created as the final measure in the data model in the Power Pivot, and were formatted
in Singapore Dollars
* This is one of many Measures in this project. The rest could be found in the report, which the Art Dealer has requested not to be released
8. CREATE PIVOT TABLE FOR TIME-BASED ANALYSIS
Created a PivotTable with total sales andYOY%
change in sales across regions (AL, CO, CA, FL)
to conduct time-based analysis
* These are just five of many Measures created in this project for analysis
* The rest could be found in the report, which the Art Dealer has requested not to be released
Two new Power Pivot Measures were created in
the ‘Merged Sales 2021-2023’Table in Power Pivot:
▪ ‘Year Sales LastYear’; and
▪ ‘YOY % Change in Sales’
The PivotTable, in
the next slide, was
configured in the
following manner,
through the
PivotTable Fields,
to produce the
outcome of Task 5
9. FINDINGS, CONCLUSIONS & RECOMMENDATIONS*
▪ In absolute-sales-dollar terms, FL and WA contributed 85% of the Total Sum of Net Sales in the 3-year period of 2021 to
2023
▪ As at 31 December 2023, the AL region performed the best, in TotalYOY % Change In Sales in this 3-year period, against
the other three regions, but it suffered the most significant drop of 43% in sales performance in 2022, against 2021,
before drastically recovering in the following year
▪ This pattern seemed to have repeated in the CA region with a drop of 12% in 2023 as compared to 2022
▪ Overall, the total-YOY-%-Change-In-Sales in this 3-year period for all four regions was 65%, which could be higher if the
year-on-year sales performance for the AL and CA regions were more consistent with the previous year/s
▪ This suggests that the data need to be further explored and mined for the possible and key contributors for the
inconsistent performance of the AL and CA regions, and to see, through the data, whether there are signs of these
reoccurring in these regions or in those regions which are consistently contributing to the overall sales performance of
the company
* These are some of many findings, conclusions and recommendations in this project.
* The rest could be found in the report, which the Art Dealer has requested not to be released
10. USING DAX & TIME-BASED
ANALYSIS IN DATA WAREHOUSE
Understand Sales Performance Across
Various Products Over Last ThreeYears
Author: Anthony Mok
Date: 18 Nov 2023
Email: xxiaohao@yahoo.com