Course: Power BI A-Z: Hands-On Power BI Training For Data Science
Welcome to the course! This chapter introduces the fundamentals of Power BI with a focused introduction to Data Analysis Expressions (DAX), the language that powers custom calculations in the tool. DAX enables you to create calculated columns, measures, and calculated tables that convert raw rows into analytical insights. A critical first step for time-based analytics is building a calendar table; for example, Dim_Calendar = CALENDAR(MIN('Fact_StrategyPlan'[Datekey]), MAX('Fact_StrategyPlan'[Datekey])). You will learn how to summarize datasets using SUMMARIZECOLUMNS and how to protect calculations from divide-by-zero errors by using DIVIDE. When writing DAX queries, remember that visual sort order is not applied automatically — you must ORDER BY the desired column. For targeted investigations you can restrict output or paginate with START AT to focus on specific records. The course contrasts calculated columns (row-level, stored) and measures (context-sensitive, computed on demand), explaining the trade-offs for modeling and performance. You’ll also practice common transformations: creating bins, segmenting customers, and building hierarchies for drilling down from Year → Month → Day. Visual lessons show how to apply these DAX results to charts (bar, area, treemap, donut), maps (using latitude/longitude), and interactive reports with slicers and filters. Finally, relational concepts such as INNER/LEFT/RIGHT/OUTER joins and handling duplicates are covered so you can join data reliably across tables. By the end of the chapter you will be able to connect a CSV, create a date dimension, write summary DAX queries, and design basic interactive visuals — the foundation you need to go deeper into Power BI analytics.Lesson
Topic: Power BI Fundamentals — DAX Basics, Calculated Tables, Summaries, Sorting, and Query Techniques
Learning Outcomes
- Understand DAX roles: calculated columns, measures, and calculated tables.
- Create a calendar table for time intelligence (CALENDAR example).
- Summarize datasets with SUMMARIZECOLUMNS and protect calculations with DIVIDE.
- Control DAX query ordering (ORDER BY) and start point (START AT).
- Apply filters, slicers, and build basic visualizations (bar, area, treemap, map).
- Understand joins, duplicates, aggregation and granularity trade-offs.
Answer
These outcomes will be validated by exercises and tasks that require writing DAX, building a calendar table, summarizing by month and category, and creating simple reports using the resulting measures and tables.
Conceptual Explanation
Power BI uses DAX to perform calculations that are either stored per row (calculated columns), computed on demand in visual context (measures), or used to produce new tables (calculated tables). A reliable time dimension is fundamental: build it from your fact table date range. Use SUMMARIZECOLUMNS for grouped summaries and DIVIDE to avoid division by zero. When querying with EVALUATE, include ORDER BY to guarantee sorting because visual sort settings do not apply to DAX queries. For focused data extraction you can use START AT to begin a result set at a given key (helpful for pagination or drilling into a range of keys).
| Purpose | DAX Example |
|---|---|
| Calendar table | |
| Summarize by month & category | |
| Order & start | |
Answer
Use these snippets as templates: replace table/column names to match your model, and add/remove filters as required.
Bilingual (EN → বাংলা)
| English | বাংলা (Bangla) | Short Explanation (EN) |
|---|---|---|
| Calculated Table | হিসাবকৃত টেবিল | A table defined by a DAX expression (CALENDAR, SUMMARIZE, etc.). |
| Calculated Column | হিসাবকৃত কলাম | Column computed row-by-row and stored in the model. |
| Measure | পরিমাপ | Aggregated value computed in visual/report context. |
| SUMMARIZECOLUMNS | SUMMARIZECOLUMNS (ফাংশন) | Group and return aggregated rows (query-level summary). |
| CALENDAR | CALENDAR (ফাংশন) | Generates a contiguous date column between min and max dates. |
| DIVIDE | DIVIDE (বিভাজন) | Performs safe division with alternate result for divide-by-zero. |
Answer
These translations help bilingual learners map terms between English and Bengali; use them to label fields and explain concepts in multilingual reports.
Important Notes
- DAX context matters: row context vs filter context — test measures in visuals with slicers to confirm behavior.
- Calculated columns increase model size; prefer measures when aggregation is all that is needed.
- When joining tables, handle duplicates by pre-aggregating with SUMMARIZE to avoid unexpected row multiplications.
- Always guard divisions with DIVIDE and check for NULLs when joining remote datasets.
Answer
Follow these best practices to reduce performance issues and ensure correct results when building models and reports.
Exercises
True / False
- SUMMARIZECOLUMNS inherits Power BI visual sort order automatically.
Answer
False — DAX queries require explicit ORDER BY.
- CALCULATED COLUMNS are evaluated once and stored in the model.
Answer
True — they are computed during processing and stored.
- DIVIDE(x, y) will raise an error if y = 0.
Answer
False — DIVIDE handles divide-by-zero and returns alternate result when provided.
Fill in the Blanks
- To create a calendar table you use the __________ function.
Answer
CALENDAR
- Use __________ to group and return aggregated rows in a DAX query.
Answer
SUMMARIZECOLUMNS
- When dividing measures safely, use the __________ function.
Answer
DIVIDE
Multiple Choice (MCQ)
- What is the best choice for a dynamic aggregation that changes with filters?
- A. Calculated Column
- B. Measure
- C. Static Table
- D. CSV file
Answer
B. Measure — Measures compute on demand and respond to filter context.
- Which clause is required to guarantee order in an EVALUATE query?
- A. FILTER BY
- B. SORT
- C. ORDER BY
- D. START AT
Answer
C. ORDER BY
Matching
Match the DAX function to its purpose:
| Function | Purpose |
|---|---|
| CALCULATE | A. Generates dates |
| CALENDAR | B. Changes filter context and evaluates expression |
| DIVIDE | C. Safe division |
Answer
CALCULATE → B, CALENDAR → A, DIVIDE → C.
Descriptive
- Explain when you would prefer a calculated column over a measure.
Answer
Use a calculated column when you need row-level values stored in the model (for slicers, relationships, or categorization), such as an Age Bin or a static Category label derived from row data. Measures are preferred for aggregations.
- Describe how you would handle duplicate product IDs when joining Sales to Products.
Answer
Pre-aggregate sales by ProductID using SUMMARIZE or SUMMARIZECOLUMNS to one row per ProductID, then join/relate to the Products table to avoid Cartesian-like duplication; or use relationships with properly defined cardinality and aggregation functions (SUMX over filtered summaries when necessary).
Creative
- Design a short dashboard plan (3 visuals) to decide “Who Gets The Annual Reward?” and list the main DAX measures required.
Answer
Dashboard plan: (1) Bar chart showing Total Sales by Employee (measure: Total Sales = SUM(Sales[Amount])), (2) Line chart of Monthly Sales Trend per Employee (measure: Orders = COUNTROWS(Sales) and Month slicer using Dim_Calendar), (3) KPI tiles for Average Profit per Order (Avg Profit = DIVIDE([Total Profit], [Orders])) and % Target Achieved (Measure with CALCULATE and target filter). Use filters/slicers to choose review period and product categories; apply ranking measure (RANKX) to highlight top candidates.
- Propose a method to color-code chart bars based on threshold (e.g., green > $10k else red).
Answer
Create a measure or calculated column returning color name: Sales Colour = IF([Total Sales] > 10000, "Green", "Red") and then apply conditional formatting on the visual by field value. Prefer measure if color should respect current filter context.
Activities, Vocabulary, Homework, Practice Task
Activities
- Activity 1: Connect to a CSV with sales data and create Dim_Calendar from the date column.
- Activity 2: Create measures Orders, Total Sales Profit, and Avg Profit per Order; build a monthly SUMMARIZECOLUMNS table and validate with a bar chart.
Answer
Activity outcomes: CSV connected, Dim_Calendar created; Measures verified in visuals and SUMMARIZECOLUMNS output matches visual aggregations.
Vocabulary
- CALENDAR — function to create date tables.
- SUMMARIZECOLUMNS — group-by summary in queries.
- DIVIDE — safe division for measures.
- START AT — begins query results at a specified key.
- RANKX — ranking function used for leaderboards.
Answer
Study these terms and use them in practice queries to solidify understanding.
Homework
- Create a Customer_Segment table using SUMMARIZE and classify customers into Low/Medium/High based on total spend; create visuals showing counts and average order values per segment.
- Write a short report (one page) explaining when to use calculated tables vs query summaries (give two practical examples).
Answer
Homework deliverables: DAX code for Customer_Segment, two visuals (bar & KPI), and the explanatory one-page report with examples (e.g., calendar table as calculated table; on-demand monthly summary using SUMMARIZECOLUMNS for ad hoc queries).
Practice Task
Task: Using your dataset, produce an EVALUATE query that lists Month Name, Product Category, Orders, Avg Profit per Order for category "Clothing", ordered by Month of Year.
Answer
EVALUATE
SUMMARIZECOLUMNS(
'Date'[Month Name],
'Date'[Month of Year],
'Product'[Category],
FILTER(VALUES('Product'[Category]), [Category] = "Clothing"),
"Orders", [Orders],
"Avg Profit per Order", DIVIDE([Total Sales Profit], [Orders])
)
ORDER BY 'Date'[Month of Year] ASC
Run and verify results; if counts differ from visuals check relationships and filter propagation.
End of lecture sheet — practice these patterns, and iterate: small models, test measures, then scale up. Ask questions in the next class for any unclear behavior in DAX context or performance.