Project Overview — What We'll Build
We're building a comprehensive sales dashboard for a fictional e-commerce company (inspired by Flipkart's analytics needs).
Dashboard Features
KPI Cards:
- Total Revenue (with YoY growth %)
- Total Orders (with MoM comparison)
- Average Order Value
- Profit Margin %
Visuals:
- Revenue trend line (daily/monthly with drill-down)
- Revenue by Product Category (bar chart)
- Revenue by Region (map)
- Top 10 Products by Revenue (table)
- Running Total Revenue (cumulative line chart)
- Revenue vs Last Year comparison (line chart with two series)
Interactivity:
- Date slicer (filter entire dashboard)
- Category filter (multi-select)
- Region filter (dropdown)
- Cross-filtering between all visuals
Skills You'll Learn
Data Modeling:
- Create a Date dimension table (required for time intelligence)
- Set up relationships (Sales ↔ Date, Sales ↔ Products)
- Configure relationship cardinality and filter direction
DAX Measures:
- Basic aggregations (SUM, COUNT, AVERAGE)
- Time intelligence (YTD, MTD, YoY, MoM)
- Running totals (CALCULATE with date filters)
- Conditional calculations (SWITCH, IF statements)
- Advanced filters (CALCULATE, FILTER, ALL)
Dashboard Design:
- Layout best practices
- Color schemes and formatting
- Interactive features (slicers, drill-down)
Dataset
Source: Download this sample sales dataset: Flipkart-style Sales Data (CSV)
Columns:
Order_ID— Unique order identifierOrder_Date— Date of orderProduct_Name— Product nameCategory— Product category (Electronics, Fashion, Home, etc.)Region— Sales region (North, South, East, West)Quantity— Units soldRevenue— Total revenue (₹)Cost— Cost of goods sold (₹)Customer_ID— Customer identifier
Size: ~5,000 orders (Jan 2024 - Dec 2025)
Step 1 — Load and Transform Data
Load the CSV File
- Open Power BI Desktop
- Home → Get Data → Text/CSV
- Select
sales_data.csv→ Open - Preview window appears → Click Transform Data
Clean Data in Power Query
// Step 1: Remove unnecessary columns (if any)
// Right-click "Internal_ID" (if exists) → Remove
// Step 2: Set correct data types
Order_Date: Date
Revenue: Currency (Decimal Number)
Cost: Currency (Decimal Number)
Quantity: Whole Number
Order_ID: Text
Customer_ID: Text
// Step 3: Add calculated columns
// Add Column → Custom Column → Name: Profit
[Revenue] - [Cost]
// Add Column → Custom Column → Name: Profit_Margin
([Revenue] - [Cost]) / [Revenue]
// Step 4: Filter out returns/cancelled orders (if Status column exists)
// Filter "Order_Status" to show only "Delivered"
// Step 5: Verify no duplicates
// Home → Keep Rows → Remove Duplicates (based on Order_ID)Close and Apply
Click Close & Apply (top-left ribbon) to load transformed data into Power BI.
Your Sales table now appears in Fields pane with these columns:
- Order_ID, Order_Date, Product_Name, Category, Region, Quantity, Revenue, Cost, Profit, Profit_Margin, Customer_ID
Step 2 — Create a Date Dimension Table
Time intelligence in Power BI REQUIRES a separate Date table (not just dates in Sales table).
Why You Need a Date Table
Problem without Date table:
- YTD, MTD, YoY calculations don't work
- Can't create fiscal calendars (if year starts in April, not January)
- Missing dates (days with no sales) break trend lines
Solution: Create a continuous Date table with ALL dates (2024-01-01 to 2025-12-31).
Create Date Table with DAX
Option 1: Quick Date Table (Auto-Generated)
- Modeling tab → New Table
- Paste this DAX:
Date =
ADDCOLUMNS(
CALENDAR(DATE(2024, 1, 1), DATE(2025, 12, 31)),
"Year", YEAR([Date]),
"Month Number", MONTH([Date]),
"Month Name", FORMAT([Date], "MMM"),
"Month Year", FORMAT([Date], "MMM YYYY"),
"Quarter", "Q" & FORMAT([Date], "Q"),
"Day of Week", FORMAT([Date], "dddd"),
"Day Number", DAY([Date]),
"Week Number", WEEKNUM([Date]),
"Is Weekend", IF(WEEKDAY([Date], 2) >= 6, "Yes", "No")
)What this does:
CALENDAR(start, end)creates a table with all dates from Jan 1, 2024 to Dec 31, 2025ADDCOLUMNSadds calculated columns for Year, Month, Quarter, etc.FORMATconverts dates to text (e.g., "Jan 2024", "Monday")
Option 2: Full Date Table (Production-Ready)
For real projects, add more columns (Fiscal Year, Holidays, etc.):
Date =
VAR StartDate = DATE(2024, 1, 1)
VAR EndDate = DATE(2025, 12, 31)
RETURN
ADDCOLUMNS(
CALENDAR(StartDate, EndDate),
"Year", YEAR([Date]),
"Year Month", FORMAT([Date], "YYYY-MM"),
"Month Number", MONTH([Date]),
"Month Name", FORMAT([Date], "MMMM"),
"Month Short", FORMAT([Date], "MMM"),
"Month Year", FORMAT([Date], "MMM YYYY"),
"Quarter", "Q" & QUARTER([Date]),
"Quarter Year", "Q" & QUARTER([Date]) & " " & YEAR([Date]),
"Day of Week", FORMAT([Date], "dddd"),
"Day of Week Number", WEEKDAY([Date], 2), // 1=Monday, 7=Sunday
"Day of Month", DAY([Date]),
"Day of Year", DATEDIFF(DATE(YEAR([Date]), 1, 1), [Date], DAY) + 1,
"Week of Year", WEEKNUM([Date], 2),
"Is Weekend", IF(WEEKDAY([Date], 2) >= 6, TRUE, FALSE),
"Is Weekday", IF(WEEKDAY([Date], 2) < 6, TRUE, FALSE),
"Fiscal Year", IF(MONTH([Date]) >= 4, YEAR([Date]), YEAR([Date]) - 1), // FY starts April 1
"Fiscal Quarter", "FY Q" & CEILING(IF(MONTH([Date]) >= 4, MONTH([Date]) - 3, MONTH([Date]) + 9), 3) / 3
)Press Enter → Date table created with 730 rows (2 years × 365 days)
Mark as Date Table
Critical step (tells Power BI this is the official Date table):
- Right-click Date table in Fields pane → Mark as Date Table
- Select
Datecolumn as the date column → OK
Create Relationship
Connect Sales table to Date table:
- Home → Manage Relationships → New
- From:
Sales[Order_Date] - To:
Date[Date] - Cardinality: Many to One (*:1) — Many sales on one date
- Cross Filter Direction: Single (Date filters Sales)
- Make this relationship active: Checked
- Click OK
Verify: Relationship appears as a line between Sales and Date tables in Model view.
Pro Tip: Always create hierarchies in Date table for drill-down. Right-click "Year" → New Hierarchy. Add Quarter → Month → Date levels. Users can drill from yearly → quarterly → monthly → daily trends with one click.
⚠️ CheckpointQuiz error: Missing or invalid options array
Step 3 — Create DAX Measures (The Power of BI)
Measures are where Power BI shines. Let's build 15 essential measures for the dashboard.
Basic Aggregation Measures
1. Total Revenue
Total Revenue = SUM(Sales[Revenue])2. Total Orders
Total Orders = COUNTROWS(Sales)
// OR: Total Orders = DISTINCTCOUNT(Sales[Order_ID]) // if duplicates possible3. Total Profit
Total Profit = SUM(Sales[Profit])4. Average Order Value (AOV)
Avg Order Value =
DIVIDE(
[Total Revenue],
[Total Orders],
0 // Returns 0 if denominator is 0 (avoids divide-by-zero error)
)5. Profit Margin %
Profit Margin % =
DIVIDE(
[Total Profit],
[Total Revenue],
0
)
// Format this measure as Percentage (0-1 → 0%-100%)Time Intelligence Measures
6. Year-to-Date (YTD) Revenue
Revenue YTD =
TOTALYTD(
[Total Revenue],
Date[Date]
)
// Requires Date table marked as Date table
// Returns revenue from Jan 1 to current date (filtered date context)7. Month-to-Date (MTD) Revenue
Revenue MTD =
TOTALMTD(
[Total Revenue],
Date[Date]
)
// Revenue from start of month to current date8. Previous Year Revenue (for YoY comparison)
Revenue Last Year =
CALCULATE(
[Total Revenue],
SAMEPERIODLASTYEAR(Date[Date])
)
// Returns revenue for same date range, but last year
// Example: If viewing Jan-Mar 2025, returns Jan-Mar 2024 revenue9. Year-over-Year (YoY) Growth %
Revenue YoY Growth % =
VAR CurrentRevenue = [Total Revenue]
VAR LastYearRevenue = [Revenue Last Year]
VAR Growth = CurrentRevenue - LastYearRevenue
RETURN
DIVIDE(Growth, LastYearRevenue, 0)
// Format as Percentage
// Example: 0.25 = 25% growth10. Month-over-Month (MoM) Growth %
Revenue MoM Growth % =
VAR CurrentMonthRevenue = [Total Revenue]
VAR PreviousMonthRevenue =
CALCULATE(
[Total Revenue],
DATEADD(Date[Date], -1, MONTH)
)
VAR Growth = CurrentMonthRevenue - PreviousMonthRevenue
RETURN
DIVIDE(Growth, PreviousMonthRevenue, 0)Running Total and Cumulative Measures
11. Running Total Revenue
Running Total Revenue =
CALCULATE(
[Total Revenue],
FILTER(
ALL(Date[Date]),
Date[Date] <= MAX(Date[Date])
)
)
// Sums revenue from start of time to current date (ignores date filters partially)
// ALL removes date filters, then FILTER reapplies up to current dateAlternative (simpler, but only for YTD running total):
Running Total Revenue YTD =
TOTALYTD([Total Revenue], Date[Date])Conditional and Advanced Measures
12. Revenue by Category (Dynamic)
Revenue - Selected Category =
CALCULATE(
[Total Revenue],
ALLSELECTED(Sales[Category])
)
// Respects slicers/filters EXCEPT Category filter (useful for "% of total" calcs)13. Top Products Revenue (Top 10)
Top 10 Products Revenue =
CALCULATE(
[Total Revenue],
TOPN(
10,
ALL(Sales[Product_Name]),
[Total Revenue],
DESC
)
)
// Returns revenue from top 10 products only14. Revenue Rank (by Product)
Product Revenue Rank =
RANKX(
ALL(Sales[Product_Name]),
[Total Revenue],
,
DESC,
DENSE
)
// Ranks products by revenue (1 = highest revenue)
// Use in table visual to show product rankings15. Dynamic Title (shows selected date range)
Dashboard Title =
VAR MinDate = MIN(Date[Date])
VAR MaxDate = MAX(Date[Date])
RETURN
"Sales Dashboard: " & FORMAT(MinDate, "DD MMM YYYY") & " to " & FORMAT(MaxDate, "DD MMM YYYY")
// Use this measure in a Card visual as dashboard title
// Example output: "Sales Dashboard: 01 Jan 2025 to 31 Mar 2025"Format Measures
After creating each measure:
- Click measure in Fields pane
- Measure Tools ribbon → Format dropdown:
- Revenue/Profit → Currency (₹), 2 decimals
- Percentages → Percentage, 1 decimal
- Orders → Whole Number, 0 decimals
- Display folder (organize measures):
- Right-click measure → Display Folder → "Revenue Metrics" or "Time Intelligence"
Step 4 — Build the Dashboard
Now let's assemble visuals into a polished dashboard.
Layout Structure (Recommended)
┌─────────────────────────────────────────────────────────────┐
│ [Dashboard Title] [Date Slicer] │ ← Header
├──────────┬──────────┬──────────┬──────────────────────────┤
│ Revenue │ Orders │ Avg Order│ Profit Margin % │ ← KPI Cards
│ ₹45.2M │ 5,234 │ ₹8,638 │ 18.5% │
│ +24% YoY │ +12% MoM │ │ │
├──────────┴──────────┴──────────┴──────────────────────────┤
│ [Revenue Trend Line Chart - Large] │ ← Main Trend
├───────────────────────────────┬─────────────────────────────┤
│ Revenue by Category (Bar) │ Revenue by Region (Map) │ ← Comparisons
├───────────────────────────────┴─────────────────────────────┤
│ Top 10 Products Table (with Revenue, Profit, Margin) │ ← Details
└─────────────────────────────────────────────────────────────┘
Visual 1: KPI Cards (Row 1)
Total Revenue Card:
- Visualizations → Card
- Drag
Total Revenuemeasure to Fields well - Format:
- Callout value: Font size 32, bold
- Category label: "Total Revenue"
- Background: Light gray (#F5F5F5)
Add YoY Growth indicator:
- Visualizations → Multi-row Card (better than Card)
- Drag
Total RevenueandRevenue YoY Growth %to Fields - Conditional formatting on YoY Growth:
- Format → Callout value → Conditional formatting
- If > 0 → Green, If < 0 → Red
Repeat for: Total Orders (with MoM growth), Avg Order Value, Profit Margin %
Visual 2: Revenue Trend Line Chart
- Visualizations → Line Chart
- X-axis:
Date[Date](or Date Hierarchy for drill-down) - Y-axis:
Total Revenue - Legend (optional):
Category(shows multiple lines per category) - Format:
- Title: "Revenue Trend"
- X-axis: Label "Date"
- Y-axis: Label "Revenue (₹)", format as Currency
- Add Average line: Analytics pane → Average line → Add
- Gridlines: Subtle (light gray)
- Enable drill-down:
- Use Date Hierarchy (Year → Quarter → Month → Day)
- Click drill-down arrow to go from yearly → monthly view
Visual 3: Revenue by Category (Bar Chart)
- Visualizations → Stacked Bar Chart (horizontal)
- Y-axis:
Sales[Category] - X-axis:
Total Revenue - Sort: Click More options (…) → Sort by → Revenue → Descending
- Data labels: On (show revenue values on bars)
- Format:
- Title: "Revenue by Category"
- Colors: Use consistent brand colors (blue shades)
Visual 4: Revenue by Region (Map)
- Visualizations → Map (or Filled Map)
- Location:
Sales[Region] - Size:
Total Revenue(bubble size by revenue) - Format:
- Title: "Revenue by Region"
- Map style: Light (better for presentations)
Note: For Indian state-level maps, you'll need to geocode regions or use a custom map visual (Mapbox, etc.)
Visual 5: Running Total Revenue (Area Chart)
- Visualizations → Area Chart
- X-axis:
Date[Date] - Y-axis:
Running Total Revenuemeasure - Format:
- Title: "Cumulative Revenue"
- Fill color: Light blue with transparency
- Line color: Dark blue
Visual 6: This Year vs Last Year Comparison
- Visualizations → Line Chart
- X-axis:
Date[Month Year](e.g., "Jan 2025") - Y-axis: Create two measures:
Total Revenue(this year)Revenue Last Year(previous year)
- Legend: Auto-populated (two series)
- Format:
- Title: "Revenue: This Year vs Last Year"
- Line colors: Blue (current), Gray (last year)
- Data labels: Off (clutters chart)
Visual 7: Top 10 Products Table
- Visualizations → Table
- Columns: Drag in order:
Sales[Product_Name]Product Revenue Rank(measure)Total RevenueTotal ProfitProfit Margin %
- Filter: Filters pane → Add filter →
Product Revenue Rank→ Show items ≤ 10 - Format:
- Conditional formatting on Revenue (data bars)
- Conditional formatting on Profit Margin (color scale: red < 10%, green > 20%)
- Alternate row shading (easier to read)
Add Slicers (Filters)
Date Range Slicer:
- Visualizations → Slicer
- Field:
Date[Date] - Format → Slicer settings → Style: Between (range slider)
- Place at top of dashboard
Category Multi-Select Slicer:
- Visualizations → Slicer
- Field:
Sales[Category] - Format → Selection controls → Multi-select: On
- Place on left sidebar
Region Dropdown:
- Visualizations → Slicer
- Field:
Sales[Region] - Format → Slicer settings → Style: Dropdown
- Place on right sidebar
Final Touches
Dashboard Title:
- Add a Card visual at the top
- Use
Dashboard Titlemeasure (dynamic date range) - Format: Large font (28pt), bold, centered
Background and Theming:
- View → Themes → Select a theme (e.g., "Executive")
- Or: Format canvas → Canvas background → Light gray (#F8F8F8)
Align and Distribute:
- Select multiple visuals → Format → Align → Distribute horizontally
- Snap to grid (View → Page view → Show gridlines)
Step 5 — Test Interactivity
Test Cross-Filtering
- Click a bar in "Revenue by Category" (e.g., Electronics)
- Verify: All other visuals filter to Electronics only:
- KPI cards show Electronics revenue/orders
- Trend line shows Electronics revenue over time
- Map shows Electronics revenue by region
- Table shows top Electronics products
- Click bar again to deselect (return to all data)
Test Slicers
Date Slicer:
- Drag slider to select Q1 2025 (Jan-Mar)
- Verify all visuals update to Q1 data
- Check YoY growth (should compare Q1 2025 vs Q1 2024)
Category Slicer:
- Select "Electronics" and "Fashion" (multi-select)
- Verify dashboard shows only these two categories
- Verify KPI cards aggregate both categories
Test Drill-Down
In Revenue Trend Chart:
- Click drill-down arrow (top-right of visual)
- Click a year (e.g., 2025)
- Chart expands to show quarters within 2025
- Click a quarter → Expands to months
- Click drill-up arrow to go back
Edit Interactions (Optional)
Sometimes you don't want cross-filtering:
Example: KPI cards shouldn't change when clicking trend line
- Click Revenue Trend visual
- Format tab → Edit Interactions
- Other visuals show filter/highlight icons
- Click None icon on KPI cards (they won't filter when trend is clicked)
- Click Edit Interactions again to exit mode
⚠️ FinalQuiz error: Missing or invalid questions array
⚠️ SummarySection error: Missing or invalid items array
Received: {"hasItems":false,"isArray":false}
Extension Challenges
Ready to level up? Extend this dashboard with these features:
1. Add Customer Segmentation
- Create RFM analysis (Recency, Frequency, Monetary) using DAX
- Segment customers into Platinum/Gold/Silver/Bronze tiers
- Add visual showing revenue contribution by segment
2. Build Forecast Model
- Use Power BI's built-in forecasting (Analytics pane → Forecast)
- Add confidence intervals (95%)
- Compare forecast vs actual for Q4 2025
3. Add Goal/Target Comparisons
- Create a Target table (manually or from Excel)
- Build DAX measures: Variance = Actual - Target, Variance % = Variance / Target
- Use Bullet charts to show KPIs vs targets
4. Create a Mobile-Optimized Layout
- View → Mobile Layout
- Design phone-friendly version (vertical scroll, large touch targets)
- Test on Power BI mobile app
5. Implement Row-Level Security (RLS)
- Modeling → Manage Roles → Create role "Region Manager"
- DAX filter:
Sales[Region] = USERNAME()orUSERPRINCIPALNAME() - Test with "View as" role feature
- Publish and assign users to roles in Power BI Service
6. Add Anomaly Detection
- Use Power BI's anomaly detection (Analytics pane)
- Highlight days with unusual spikes/drops
- Create measure to flag anomalies:
Is Anomaly = IF([Revenue] > [Avg Revenue] + 2*[StdDev Revenue], "Yes", "No")
7. Export to PowerPoint
- File → Export → PowerPoint (creates slides with live visuals)
- Or use Power BI add-in for PowerPoint (interactive slides)
These challenges will make your portfolio project stand out — pick 2-3 to implement!