Course: Data Connections in Power BI
In Power BI, data connections form the structural backbone that enables analysts to import, model, and visualize business data from diverse sources such as databases, Excel workbooks, cloud services, and APIs. Establishing the correct connection type—Import, DirectQuery, or Composite—affects refresh cadence, query performance, and the complexity of calculations you can perform. DAX (Data Analysis Expressions) complements these connections by allowing you to create calculated tables and measures that enrich the data model; a common example is constructing a calendar table using CALENDAR(MIN(...), MAX(...)). Once your tables and relationships are in place, SUMMARIZECOLUMNS and other DAX functions help you aggregate and group data for reporting, often combined with FILTER and DIVIDE to produce robust metrics like average profit per order. When issuing DAX queries directly (EVALUATE), remember to include ORDER BY (and optionally START AT) because the visual sort order is not automatically applied in query results. Power Query's M language is typically used upstream to transform and clean data before it is loaded into the model, enabling steps such as filtering, merging, and appending multiple sources. Incremental refresh and query parameters reduce load times and improve scalability by partitioning data and refreshing only recent partitions. Managing data source settings and credentials centrally (Desktop vs Service) is essential for deployment, scheduled refresh, and collaboration across teams. Security, privacy levels, and correct relationship design remain critical to ensure analytical correctness and to avoid ambiguous calculations. Effective use of calculated tables, measures, and storage mode choices lets you balance performance with real-time requirements and data volume. Practically, creating a Dim_Calendar table, summarizing clothing sales by month, and using START AT in queries are concrete patterns you will use repeatedly. As you progress, combining M transformations with DAX semantics will let you build repeatable, maintainable models that scale to enterprise requirements. Ultimately, mastering connections, DAX, and M yields faster insights and more trustworthy dashboards that drive decisions.Lesson
Topic: Data Connections in Power BI
Learning Outcomes
- Understand Power BI connection types: Import, DirectQuery, Composite.
- Create calculated tables and a calendar table using DAX.
- Summarize and filter data with SUMMARIZECOLUMNS and related DAX functions.
- Configure incremental refresh and query parameters for large datasets.
- Distinguish roles of Power Query (M) and DAX in the ETL and modeling pipeline.
- Compose DAX queries with explicit ordering and starting points (ORDER BY, START AT).
Conceptual Explanation
Power BI connects to many data sources; the choice of storage mode affects performance and refresh options. Use Power Query (M) to perform transformations before loading and use DAX to build model-level calculations after loading. Calculated tables are useful for constructing dimensions such as date tables; measures and summarization enable row-level aggregation for reports. DAX queries executed via EVALUATE return tables and require explicit ORDER BY when deterministic ordering is needed. Incremental refresh combined with parameters reduces workload on refresh operations for growing tables. Below are compact examples and patterns you will reference.
| Purpose | Example | Notes |
|---|---|---|
| Create calendar table | |
Use as a date dimension for time intelligence. |
| Summarize by month & category | |
Include ORDER BY if presentation order matters. |
| Query with ordering & start | |
Useful for pagination or focused exports. |
Bilingual (EN → বাংলা)
- Data Connection — ডেটা সংযোগ
- Calculated Table — হিসাবকৃত টেবিল
- Calendar Table — ক্যালেন্ডার টেবিল
- Summarize — সারাংশ/সংক্ষেপ
- Incremental Refresh — ধাপে ধাপে রিফ্রেশ
- ORDER BY / START AT — সাজানো / নির্দিষ্ট শুরু পয়েন্ট
Answer
উপরের শব্দগুলো শিক্ষার্থীদেরকে বিষয়ভিত্তিক ধারণা বাংলায় দ্রুত বোঝাতে সাহায্য করবে।
Important Notes
- ORDER BY must be included in DAX queries to enforce a specific sort order.
- Power Query (M) transformations run before DAX calculations—design accordingly.
- Choose storage mode based on latency, dataset size, and refresh needs.
- Use DIVIDE() to avoid division-by-zero errors in measures.
- Manage credentials and data source settings when moving from Desktop to Service.
Exercises
True / False
- DirectQuery stores the full dataset in Power BI memory.
Answer
False — DirectQuery does not import the data; it queries the source at runtime.
- SUMMARIZECOLUMNS can accept filters and measures.
Answer
True — it groups by columns and allows filters and expression columns.
- DAX queries automatically respect the sort order defined in report visuals.
Answer
False — DAX queries require explicit ORDER BY to ensure ordering.
Fill in the Blanks
- To create a calendar table in DAX use the ______ function.
Answer
CALENDAR
- The clause used to set a starting point in an EVALUATE query is ______.
Answer
START AT
- To avoid division by zero in measures use the ______ function.
Answer
DIVIDE()
Multiple Choice (MCQ)
- Which storage mode is best for large datasets requiring near real-time access?
- A. Import
- B. DirectQuery
- C. Composite
Answer
B. DirectQuery — it queries the source in real time without importing all data.
- Which language is used for data transformation in Power Query?
- A. DAX
- B. M
- C. SQL
Answer
B. M — Power Query Formula Language (M) handles transformations before loading.
Matching
| Feature | Role |
|---|---|
| CALENDAR() | Create date dimension |
| SUMMARIZECOLUMNS() | Group and aggregate rows |
| Incremental refresh | Refresh partitions only |
Answer
Matches: CALENDAR() → Create date dimension; SUMMARIZECOLUMNS() → Group and aggregate rows; Incremental refresh → Refresh partitions only.
Descriptive
- Explain how you would implement incremental refresh for a transactional table.
Answer
Define RangeStart and RangeEnd parameters in Power Query, filter the table by those parameters, publish to Service, then configure the incremental refresh policy for the table (set store period and refresh period). Ensure the date column is a proper Date/DateTime type and test refresh on a dataset subset before full deployment.
- Describe the difference between creating a date table in M vs DAX.
Answer
In M (Power Query) you generate and transform the date table before loading into the model, which can reduce model size and preprocessing cost. In DAX, a calculated table is created after the model is loaded and may be evaluated in the engine; DAX date tables are convenient for dynamic calculations but may affect refresh behavior and model size differently.
Creative
- Design a small project: import sales data, build Dim_Calendar, compute monthly clothing orders and average profit per order, and publish to Power BI Service. Outline the steps.
Answer
- Get Data from source (SQL/Excel), preview and transform in Power Query (filter, data types).
- Create parameters for incremental refresh if dataset large.
- Load data; in Model view add relationships between sales and product/date tables.
- Create Dim_Calendar via DAX: CALENDAR(MIN(...), MAX(...)) and add month/year columns.
- Create measures: [Orders], [Total Sales Profit]; compute Avg Profit per Order using DIVIDE.
- Use SUMMARIZECOLUMNS for verification and create report visuals; add ORDER BY in DAX queries used for exports.
- Publish to Power BI Service, configure dataset credentials and scheduled refresh, test visuals.
Activities, Vocabulary, Homework, Practice Task
Activities
- Walkthrough: connect to a sample SQL database and import tables.
- Hands-on: create Dim_Calendar and at least two measures; visualize monthly trend.
Answer
Complete the walkthrough and save PBIX file; check that relationships and measures return expected values.
Vocabulary
- Data Source
- Calculated Table
- Measure
- Incremental Refresh
- DirectQuery
Answer
Review definitions and create flashcards for each term.
Homework
- Build a sample report that filters sales to a single product category using SUMMARIZECOLUMNS.
- Document steps for changing data source settings from development to production.
Answer
Deliver a PBIX and a one-page document describing the connection change and refresh credentials steps.
Practice Task
Write a DAX query that returns monthly orders for "Clothing" and sorts by month number.
Answer
EVALUATE
SUMMARIZECOLUMNS(
'Date'[Month Name],
'Date'[Month of Year],
FILTER( VALUES('Product'[Category]), [Category] = "Clothing" ),
"Orders", [Orders]
)
ORDER BY 'Date'[Month of Year] ASC