Starter files to initialize and analyze the Smart Sales project.
Run all commands from a PowerShell terminal in the root project folder.
py -m venv .venv
.venv\Scripts\activatepy -m pip install --upgrade pip setuptools wheel
py -m pip install --upgrade -r requirements.txtpy -m datafun_venv_checker.venv_checkerpy scripts/data_prep.pygit pull origin maingit add .git commit -m "Your commit message here"git push -u origin main- pip
- loguru
- ipykernel
- jupyterlab
- numpy
- pandas
- matplotlib
- seaborn
- plotly
- pyspark==4.0.0.dev1
- pyspark[sql]
- git+https://github.com/denisecase/datafun-venv-checker.git#egg=datafun_venv_checker
Run the script to define and create tables for your data warehouse:
py scripts/create_dw.pyRun the ETL script to populate the database:
python3 scripts/etl_to_dw.py- Install Power BI Desktop: Download Power BI
- Install SQLite ODBC Driver: Download SQLite ODBC
- Configure ODBC Data Source Name (DSN) for
SmartSalesDSN. - Use Power BI to connect to the database and create visualizations:
- Sales trends by year, quarter, or month.
- Top customers and sales by region or category.
- Analyze sales by day of the week and product to determine staffing needs.
- Analyze sales by region to identify areas for improvement.
- Analyze sales by month to understand seasonal spending patterns.
- Data used:
smartsales.db - Fields:
sale_id,customer_id,product_id,sale_amount_usd, andregion. - Aggregations: Sales were summed, and
sale_idwas counted for reporting.
- OLAP and Cubing Scripts were used to analyze data and generate insights.
- Dimensions:
DayOfWeek,Month,Region,product_id, andcustomer_id. - Metrics: Sum and mean of
sale_amount_usd, and count ofsale_id.
- Sales by Day and Product

- Sales by Day of Week

- Sales by Month and Product

- Sales by Region

- Month Details

- Least Profitable Day: Friday with revenue of $8,617.76.
- Least Profitable Region: West with revenue of $4,233.64.
- Least Profitable Months: May and June.
- Top Product: Product ID 101 (laptop).
- Adjust operating hours on Fridays.
- Introduce new products or promotions for May and June.
- Share best practices from the East region to improve sales in other regions.
- Minor issues with the logger script and OLAP scripts were resolved using Copilot.
After completing your analysis and visualizations:
git add .
git commit -m "Completed analysis and visualization"
git push -u origin mainTo identify areas of concern regarding product returns by customer, state, region, category, date, and product.
- Dataset: Superstore Sample Data
- Descriptive Dimensions:
product_id,category,region,customer_id,sale_date, andstate- These dimensions were analyzed to understand return patterns.
- Numeric Metrics:
cost,quantity, andsales
- Python: For data cleaning and transformation using
pandasandsqlite3. - Power BI: For visualizations and DAX queries.
- Copilot: Assisted with resolving ETL and visualization challenges.
- Data Preparation:
- Cleaned and transformed raw data using Python.
- Loaded data into a data warehouse (
store_returns.db).
- Aggregations:
- Summed metrics by dimensions.
- Calculated return percentage of total sales.
- Slicing and Dicing:
- Sliced data by customer, product, category, and region.
- Added options to view returns by year and dice further by state.
- Drilldown:
- Enabled drilldowns by customer or region to product ID.
- Total Returns: $181,008.26
- Total Sales: $2,299,031.59
- Overall Return Percentage: 7.87%
| Category | Returns | Sales | Return % |
|---|---|---|---|
| Technology | $73,212.13 | $837,984.62 | 8.74% |
| Furniture | $59,219.21 | $741,999.98 | 7.98% |
| Office Supplies | $48,576.92 | $719,046.99 | 6.76% |
| Region | Returns | Sales | Return % |
|---|---|---|---|
| West | $107,483.06 | $725,457.93 | 14.82% |
| East | $41,705.12 | $678,781.36 | 6.14% |
| Central | $14,006.99 | $501,239.88 | 2.79% |
| South | $17,309.13 | $391,721.90 | 4.42% |
| North | $503.96 | $1,830.52 | 27.53% |
- Highest Return %: 27.53% in 2025.
- Lowest Return %: 5.93% in 2016.
- Visuals:
- Sales by Region: Area chart using
sale_dateandsales. - Sales and Returns by Category: Column chart showing Technology as the top category for both sales and returns.
- Returns by Region: Area chart using Year and Total Returns.
- Slicer: Drill down by state for total sales and returns.
- Sales by Region: Area chart using
- Visuals:
- Filled map showing return dollars by state.
- Slicer for drilling down to more detail by state.
- Key Metrics: Total Sales, Total Profit, Product Return %
- Visuals:
- Sales by Product: Column chart using
nameandsales. - Sales Distribution by Category: Pie chart using
categoryandsales. - Profit by Product: Column chart using
nameandprofit. - Profit Distribution by Category: Pie chart using
categoryandprofit. - Return Rate by Product: Column chart using
nameand Product Return %. - Return Rate Distribution by Category: Pie chart using
categoryand Category Return %.
- Sales by Product: Column chart using
- Key Metrics: Total Sales, Total Profit
- Visuals:
- Sales by Customer Segment: Column chart using
segmentandsales. - Sales Distribution by Customer Segment: Pie chart using
segmentandsales. - Profit by Customer Segment: Column chart using
segmentandprofit. - Profit Distribution by Customer Segment: Pie chart using
segmentandprofit.
- Sales by Customer Segment: Column chart using
- Address High Return Rates:
- Focus on the West region, which has a return rate of 14.82%.
- Drill down into California and Washington to identify specific issues.
- Investigate High-Return Products:
- The Canon image CLASS 2200 Advanced Copier had the highest return value ($13,999.96) but was also the most profitable product.
- Improve Processes in the North Region:
- The North region has a skewed return rate (27.53%) due to low sales volume.
- Monitor Category Trends:
- Technology has the highest return percentage (8.74%).
- Data Selection:
- Finding a large dataset was challenging but resolved with the Superstore dataset.
- ETL Process:
- Encountered issues with Python scripts but resolved them using Copilot.
- Power BI:
- Linking multiple tables from the data warehouse was challenging but resolved through trial and error with Copilot.
- The dataset was publicly available and contained no personal or sensitive data.
- Added a few rows of data with future dates, which introduced potential bias in date-based analysis.
After completing your analysis and visualizations:
git add .
git commit -m "Completed custom BI project"
git push -u origin main



