🎯 Mục tiêu bài học
Sau bài học này, bạn sẽ:
✅ Hiểu Power BI ecosystem: Desktop, Service, Mobile
✅ Connect và transform data với Power Query
✅ Build star schema data model với relationships
✅ Viết DAX formulas: SUM, CALCULATE, Time Intelligence
✅ Tạo interactive reports với slicers và drill-through
✅ So sánh Power BI vs Tableau — khi nào dùng cái nào
Thời gian: 45 phút | Độ khó: Beginner | Tool: Power BI Desktop (Free)
📖 Bảng Thuật Ngữ Quan Trọng
| Thuật ngữ | Tiếng Việt | Mô tả |
|---|---|---|
| DAX | Data Analysis Expressions | Formula language của Power BI |
| Measure | Phép đo | Aggregation calculated at runtime |
| Calculated Column | Cột tính toán | Row-by-row calculation, stored in model |
| Star Schema | Mô hình sao | Fact table ở giữa, dimensions xung quanh |
| Power Query | Truy vấn nguồn | ETL tool tích hợp trong Power BI |
| Slicer | Bộ lọc trực quan | Interactive filter control trên report |
| Drill-through | Khoan sâu | Click → navigate to detail page |
| Bookmark | Đánh dấu | Lưu state cụ thể (filters, visible visuals) |
| Filter Context | Ngữ cảnh bộ lọc | Tập hợp filters đang active cho calculation |
| CALCULATE | Hàm CALCULATE | DAX function thay đổi filter context |
Checkpoint
DAX = formula language của Power BI. Measure = aggregation at runtime. CALCULATE = thay đổi filter context. Star Schema = fact + dimensions. Bạn phân biệt Measure vs Calculated Column chưa?
🖥️ 1. Power BI Ecosystem
1.1 Power BI Products
| Product | Platform | Purpose | Cost |
|---|---|---|---|
| Power BI Desktop | Windows | Create reports | Free |
| Power BI Service | Web | Share & collaborate | Free/$10/mo |
| Power BI Mobile | iOS/Android | View on mobile | Free |
| Power BI Report Server | On-premise | Internal hosting | License |
1.2 Power BI Desktop Interface
| Khu vực | Vị trí | Nội dung |
|---|---|---|
| Ribbon | Top | File, Home, Insert, Modeling, View, Optimize, Help |
| Filters Pane | Left | Page/Visual/Drillthrough filters |
| Report Canvas | Center | Drag visuals here |
| Visualizations | Right-top | Chart type selector (▤▥▦▧▨▩) |
| Fields | Right-bottom | Tables and columns hierarchy |
| View Tabs | Bottom | 📊 Report · 📋 Data · 🔗 Model |
1.3 Three Views
| View | Icon | Purpose |
|---|---|---|
| Report | 📊 | Build visualizations |
| Data | 📋 | View/edit tables |
| Model | 🔗 | Manage relationships |
Power BI Desktop hoàn toàn miễn phí! Chỉ cần trả phí khi publish lên Service cho team collaboration. Download tại powerbi.microsoft.com
Checkpoint
Power BI có 3 views: Report (build visuals), Data (xem tables), Model (manage relationships). Desktop = Free, chỉ Service cần trả phí!
📥 2. Getting Data & Power Query
2.1 Data Sources
2.2 Load vs Transform
| Option | When to Use |
|---|---|
| Load | Data is clean, ready to use |
| Transform | Need cleaning, reshaping |
2.3 Power Query Editor
| Khu vực | Vị trí | Nội dung |
|---|---|---|
| Ribbon | Top | Home, Transform, Add Column, View, Tools, Help |
| Queries | Left-top | Orders, Products, Customers |
| Applied Steps | Left-bottom | Source → Navigation → Changed Type |
| Preview | Center | Data table preview (OrderID, Date, Customer, Amount) |
| Formula Bar | Center-top | = Table.TransformColumnTypes(...) |
2.4 Common Transformations
| Action | Use Case |
|---|---|
| Remove columns | Delete unnecessary fields |
| Filter rows | Remove nulls, errors |
| Change type | Text → Number, Date |
| Replace values | Clean up data |
| Split column | "John Doe" → "John", "Doe" |
| Merge queries | Join tables |
| Append queries | Stack tables |
| Pivot/Unpivot | Reshape data structure |
Power Query = ETL trong Power BI. Mọi bước transform được ghi lại thành Applied Steps — có thể undo, reorder, hoặc edit bất cứ lúc nào!
Checkpoint
Power Query ghi lại mọi transform thành Applied Steps. Common transforms: remove columns, filter rows, change types, pivot/unpivot. Bạn đã dùng Transform Data chưa?
🔗 3. Data Modeling
3.1 Star Schema
3.2 Creating Relationships
Model View → Drag field from Table A to Table B
3.3 Best Practices
✅ DO:
- Use star schema (facts + dimensions)
- Hide technical keys from report view
- Create date dimension table
- Name tables and columns clearly
❌ DON'T:
- Many-to-many without bridge table
- Circular dependencies
- Too many bi-directional filters
- Wide tables với 100+ columns
Star Schema là foundation của mọi Power BI model tốt. Fact table chứa numbers (Sales, Quantity), Dimension tables chứa attributes (Product Name, Region). Không có star schema → DAX sẽ rất khó viết!
Checkpoint
Star Schema: Fact table (numbers) ở giữa, Dimension tables (attributes) xung quanh. Relationships thường One-to-Many, single direction. Bạn đã tạo model view chưa?
📐 4. DAX Basics
4.1 Calculated Column vs Measure
| Aspect | Calculated Column | Measure |
|---|---|---|
| Calculated | Row by row | On aggregation |
| Storage | Stored in model | Calculated at runtime |
| Use | Categorization, filtering | Aggregations, KPIs |
| Performance | Uses memory | More efficient |
4.2 Essential DAX Functions
1-- SUM, AVERAGE, COUNT2Total Sales = SUM(Sales[Amount])3Avg Order = AVERAGE(Sales[Amount])4Order Count = COUNT(Sales[OrderID])5 6-- DISTINCTCOUNT7Customer Count = DISTINCTCOUNT(Sales[CustomerID])8 9-- CALCULATE - thay đổi filter context10Sales East = CALCULATE(11 SUM(Sales[Amount]),12 Region[RegionName] = "East"13)14 15-- Time Intelligence16Sales YTD = TOTALYTD(SUM(Sales[Amount]), 'Date'[Date])17Sales PY = CALCULATE(18 SUM(Sales[Amount]),19 SAMEPERIODLASTYEAR('Date'[Date])20)21 22-- Year-over-Year Growth23YoY Growth = 24VAR CurrentYear = SUM(Sales[Amount])25VAR LastYear = CALCULATE(26 SUM(Sales[Amount]),27 SAMEPERIODLASTYEAR('Date'[Date])28)29RETURN 30DIVIDE(CurrentYear - LastYear, LastYear, 0)4.3 Filter Context & ALL
1-- ALL removes filter context2Total All Products = CALCULATE(3 SUM(Sales[Amount]),4 ALL(Product)5)6 7-- % of Total8% of Total = 9DIVIDE(10 SUM(Sales[Amount]),11 CALCULATE(SUM(Sales[Amount]), ALL(Sales)),12 013)4.4 Variables (VAR)
1Profit Margin = 2VAR TotalRevenue = SUM(Sales[Revenue])3VAR TotalCost = SUM(Sales[Cost])4VAR Profit = TotalRevenue - TotalCost5RETURN6DIVIDE(Profit, TotalRevenue, 0)CALCULATE là hàm quan trọng nhất trong DAX — nó thay đổi filter context. VAR giúp code clean và readable. Luôn dùng DIVIDE thay vì / để tránh divide-by-zero errors!
Checkpoint
CALCULATE = thay đổi filter context. ALL = remove filters. DIVIDE = safe division. VAR = clean code. Measure > Calculated Column cho performance!
📊 5. Building Reports
5.1 Visual Types
| Icon | Visual Type |
|---|---|
| ▤ | Stacked bar |
| ▥ | Clustered bar |
| ▦ | Stacked column |
| ▧ | Line chart |
| ▨ | Area chart |
| ▩ | Combo chart |
| ○ | Pie/Donut |
| ⬡ | Treemap |
| 🗺 | Map |
| 📊 | Matrix |
| 📋 | Table |
| 📇 | Card |
| 🎯 | KPI |
| ⬚ | Slicer |
5.2 Card Visuals for KPIs
| KPI | Value | Change |
|---|---|---|
| Total Sales | $2.5M | ▲ 15% |
| Profit | $420K | ▲ 8% |
| Orders | 12,547 | ▲ 22% |
5.3 Slicers & Filters
Slicer types:
- List (checkboxes)
- Dropdown
- Date range (slider)
- Relative date ("Last 30 days")
Checkpoint
Power BI có 15+ visual types. Card cho KPIs, Slicer cho interactive filters. Drag fields vào Axis, Values, Legend, Tooltips wells. Bạn đã tạo report đầu tiên chưa?
🔄 6. Interactivity & Advanced
6.1 Cross-filtering
1Click bar in Chart A → 2 Chart B filters to show related data3 Chart C highlights related data6.2 Edit Interactions
Format → Edit Interactions
6.3 Drill-through
1Setup:21. Create detail page32. Add drill-through field (e.g., Product)43. Right-click on visual → Drill through5 6Main Report: Click "Electronics" →7 Drill through → Detail page filtered to Electronics6.4 Bookmarks
Save specific states: Filters applied, Visuals visible/hidden, Page navigation
Use for: Toggle views (detailed/summary), Guided navigation, Presentations
Checkpoint
Cross-filtering = click 1 chart → filter others. Edit Interactions = control filter/highlight/none. Drill-through = navigate to detail page. Bookmarks = saved states!
⚖️ 7. Power BI vs Tableau
Comparison
| Aspect | Power BI | Tableau |
|---|---|---|
| Price | $10/user/mo | $70/user/mo |
| Ease | Easier start | Steeper curve |
| Visualization | Good | Excellent |
| Data Modeling | Excellent | Good |
| DAX/Calcs | Very powerful | Powerful |
| Microsoft | Native integration | Connectors |
| Community | Growing | Mature |
When to Use Which?
Choose Power BI:
- Microsoft 365 organization
- Budget-conscious
- Need strong data modeling
- Self-service BI focus
Choose Tableau:
- Visualization-heavy needs
- Complex analytics
- Cross-platform teams
- Premium features needed
Cả hai đều tuyệt vời — Power BI mạnh về data modeling + Microsoft integration, Tableau mạnh về visualization + flexibility. Biết cả hai = competitive advantage lớn!
Checkpoint
Power BI: rẻ hơn, Microsoft integration, strong modeling. Tableau: visualization premium, cross-platform. Biết cả hai là competitive advantage trong job market!
🏋️ 8. Hands-on: Sales Report
Build executive sales dashboard hoàn chỉnh trong Power BI!
Page 1: Executive Summary
| Vị trí | Nội dung |
|---|---|
| KPI Row | 💰 Revenue: $2.5M · 📈 Growth: +15% · 📦 Orders: 12K · 👥 Customers: 3.2K |
| Middle Left | Revenue by Month (Line) |
| Middle Right | Revenue by Region (Map) |
| Bottom Left | Top Products (Bar) |
| Bottom Right | Segment Split (Donut) |
| Filters | Date Slicer · Region · Segment |
Page 2: Product Detail (Drill-through)
Key DAX Measures
1Revenue = SUM(Sales[Amount])2Revenue YTD = TOTALYTD([Revenue], 'Date'[Date])3Revenue PY = CALCULATE([Revenue], SAMEPERIODLASTYEAR('Date'[Date]))4Growth % = DIVIDE([Revenue] - [Revenue PY], [Revenue PY], 0)5Profit Margin = DIVIDE(SUM(Sales[Profit]), SUM(Sales[Revenue]), 0)📋 Tổng kết
Kiến thức đã học
| Chủ đề | Nội dung chính | Tầm quan trọng |
|---|---|---|
| Ecosystem | Desktop (free), Service, Mobile | Overview |
| Power Query | ETL, Applied Steps, transforms | Data prep |
| Data Model | Star schema, relationships | Foundation |
| DAX | CALCULATE, Time Intelligence, VAR | Core skill |
| Reports | Cards, Slicers, 15+ visual types | Building |
| Interactivity | Cross-filter, Drill-through, Bookmarks | Advanced |
| vs Tableau | Price, features, when to use | Career |
Câu hỏi tự kiểm tra
- Power Query vs DAX: khi nào dùng cái nào?
- Star schema là gì và tại sao quan trọng?
- CALCULATE trong DAX dùng để làm gì?
- Cross-filter và cross-highlight khác nhau thế nào?
Bài tiếp theo: Design Best Practices — Nguyên tắc thiết kế dashboard đẹp và hiệu quả!
🎉 Tuyệt vời! Bạn đã nắm vững Power BI Desktop!
Nhớ: Power Query để clean data, DAX để tính toán, Report để trình bày — 3 bước cho mọi dự án BI!
