Popular Searches
Popular Course Categories
Popular Courses

Building Star and Snowflake Schemas

Building Star and Snowflake Schemas

Data Modeling and Relationships

Building Star and Snowflake Schemas in Power BI

Course: Microsoft Power BI Training

Topic: Building Star and Snowflake Schemas

Course Link: Microsoft Power BI Training at JustAcademy

Demo Link: Register for a Free Course Demo

JustAcademy Website: Visit JustAcademy


1. Introduction to Star and Snowflake Schemas

Star and snowflake schemas are two important data modeling techniques used in business intelligence, data warehousing, and Microsoft Power BI. They organize data into fact and dimension tables to make reporting, analysis, and dashboard development easier.

When building Power BI reports, a well-designed data model helps users analyze business performance across different dimensions, such as products, customers, locations, employees, and time periods.

A star schema generally uses a central fact table connected directly to dimension tables. A snowflake schema organizes dimensions into additional related tables through normalization.

1.1 What Is a Data Schema?

A data schema defines how tables are structured and how they relate to one another. It specifies the columns, keys, relationships, and organization of data within a database or analytical model.

For example, a sales reporting model might contain the following tables:

  • Sales: Stores transaction-level sales information.
  • Product: Stores product names, categories, and brands.
  • Customer: Stores customer details and segments.
  • Date: Stores dates, months, quarters, and years.
  • Geography: Stores city, state, and country information.

These tables can be connected to create reports such as monthly revenue, sales by category, and customer performance.

1.2 What Is Dimensional Modeling?

Dimensional modeling is a data design approach that structures information for analytical queries and reporting. It separates measurable business events from the descriptive information used to analyze them.

Dimensional models commonly use two main types of tables:

  • Fact tables: Contain business measurements, transaction records, and foreign keys that connect to dimensions.
  • Dimension tables: Contain descriptive attributes that help users filter, group, and categorize facts.

2. Understanding Fact Tables

A fact table stores measurable business events. In a sales model, it might record the quantity sold, sales amount, discount, cost, and identifiers for the product, customer, and date.

2.1 Example of a Sales Fact Table

SalesID DateKey ProductKey CustomerKey Quantity SalesAmount
1001 20260101 101 501 2 1500
1002 20260102 102 502 1 800
1003 20260103 101 503 3 2250
1004 20260104 103 501 2 1200

In this example, each row represents a sales transaction. The keys identify the corresponding date, product, and customer in dimension tables.

2.2 Characteristics of Fact Tables

  • Store numeric measurements used in calculations.
  • Contain foreign keys referencing dimension tables.
  • Often contain many rows compared with dimension tables.
  • Represent a clearly defined level of detail, known as the grain.
  • Support calculations such as total sales, quantity sold, cost, and profit.

2.3 Understanding Fact Table Grain

Grain defines exactly what one row in a fact table represents. It must be decided before designing the model.

Examples of grain include:

  • One row per sales order line.
  • One row per product per store per day.
  • One row per customer invoice.
  • One row per inventory item per warehouse per month.

Best practice: Avoid combining records at different levels of detail in the same fact table unless the model is deliberately designed to handle the differences. Inconsistent grain can cause incorrect aggregations.

3. Understanding Dimension Tables

Dimension tables contain descriptive information about the entities involved in business events. They make fact table measurements meaningful to report users.

3.1 Example of a Product Dimension

ProductKey ProductName Category Brand
101 Laptop Electronics Brand A
102 Keyboard Accessories Brand B
103 Monitor Electronics Brand C

This dimension lets users analyze sales by product name, category, and brand without storing those descriptive values repeatedly in every sales transaction.

3.2 Common Dimension Tables

  • Date Dimension: Date, day, month, quarter, year, and financial period.
  • Product Dimension: Product name, SKU, brand, category, and subcategory.
  • Customer Dimension: Customer name, customer type, segment, and demographic attributes where appropriate.
  • Geography Dimension: City, state, region, and country.
  • Employee Dimension: Employee name, department, job title, and manager.
  • Store Dimension: Store name, store type, and location.

3.3 Primary Keys and Surrogate Keys

A primary key uniquely identifies each row in a dimension table. A surrogate key is a generated identifier used to represent a dimension record independently of the original business identifier.

For example, ProductKey 101 might identify a laptop in the Product dimension. The Sales table references this key to connect a transaction to the correct product.

Dimension keys should be unique on the dimension side of a one-to-many relationship. Duplicate keys can prevent the intended relationship from being created or cause ambiguous results.

4. What Is a Star Schema?

A star schema is a dimensional data model in which one central fact table connects directly to multiple dimension tables. Its visual structure resembles a star, with the fact table at the center and dimension tables surrounding it.

4.1 Structure of a Star Schema

                 Date Dimension
                        |
                        |
Customer Dimension -- Sales Fact -- Product Dimension
                        |
                        |
                 Store Dimension

The Sales Fact table contains sales measurements and foreign keys. Each dimension provides descriptive attributes for analyzing those measurements.

4.2 Example of a Star Schema

A retail company might create the following tables:

  • FactSales: DateKey, ProductKey, CustomerKey, StoreKey, Quantity, SalesAmount, CostAmount.
  • DimDate: DateKey, Date, Month, Quarter, Year.
  • DimProduct: ProductKey, ProductName, Category, Brand.
  • DimCustomer: CustomerKey, CustomerName, Segment, City.
  • DimStore: StoreKey, StoreName, Region, Country.

Each dimension connects directly to FactSales using its key. This structure enables users to analyze revenue by year, product category, customer segment, and store region.

4.3 Advantages of a Star Schema

  • Simple structure: Easy for developers and report users to understand.
  • Efficient filtering: Dimensions provide clear filtering paths to fact tables.
  • Convenient DAX calculations: Measures can be built around clearly defined business events.
  • Good report usability: Descriptive columns are grouped into logical tables.
  • Reduced relationship complexity: Fewer joins between dimension tables are usually required.
  • Improved maintainability: A clear model is easier to test, document, and troubleshoot.

4.4 Limitations of a Star Schema

  • Dimension attributes may be repeated across multiple records.
  • Large dimensions with extensive hierarchies can contain redundant descriptive data.
  • Changes to shared reference data may require careful ETL or Power Query processing.
  • Some complex enterprise data structures may require additional normalized tables or a separate data warehouse layer.

5. What Is a Snowflake Schema?

A snowflake schema is a dimensional model in which one or more dimension tables are split into related sub-dimension tables. This process is commonly associated with normalization.

Instead of storing every descriptive attribute in one dimension table, a snowflake model separates related attributes into multiple tables and connects them through keys.

5.1 Structure of a Snowflake Schema

                    Category
                        |
                        |
Brand -- Product Subcategory -- Product
                                  |
                                  |
                              Sales Fact
                                  |
                                  |
                             Date Dimension

In this simplified example, product details are separated from product subcategories and categories. The Product dimension connects to the fact table, while the product hierarchy is represented through additional related tables.

5.2 Example of a Snowflake Schema

A normalized product model might use these tables:

  • FactSales: Sales measurements and dimension keys.
  • DimProduct: ProductKey, ProductName, SubcategoryKey.
  • DimSubcategory: SubcategoryKey, SubcategoryName, CategoryKey.
  • DimCategory: CategoryKey, CategoryName.
  • DimDate: DateKey, Date, Month, Year.

The relationship path from a product category to sales runs through the product hierarchy and then to the fact table.

5.3 Advantages of a Snowflake Schema

  • Reduced duplication: Shared descriptive attributes can be stored once in separate tables.
  • Structured hierarchies: Useful when products, locations, or organizational units have multiple levels.
  • Centralized reference data: Shared categories can be managed in one location.
  • Potentially smaller dimension tables: Separating repeated attributes can reduce duplication in the source model.
  • Suitable for complex data warehouses: Can reflect normalized enterprise data structures and governed reference data.

5.4 Limitations of a Snowflake Schema

  • Creates more tables and relationships to manage.
  • Can make the model harder for report creators to understand.
  • May require additional relationship traversal when filtering and grouping data.
  • Can introduce ambiguity if relationships are poorly designed.
  • May complicate DAX expressions and troubleshooting when developers do not understand filter propagation.
  • Does not automatically improve Power BI report performance merely because duplication has been reduced.

6. Star Schema vs. Snowflake Schema

Feature Star Schema Snowflake Schema
Structure Central fact table connected directly to dimensions Fact table connected to dimensions that may have related sub-dimensions
Dimension design Generally denormalized Generally more normalized
Number of tables Usually fewer Usually more
Data duplication May contain repeated descriptive attributes Can reduce repetition by separating shared attributes
Ease of understanding Generally easier for report creators Requires understanding additional relationships
Relationship complexity Usually lower Can be higher
Power BI usability Often preferred for semantic models Useful when normalized dimensions offer a clear benefit
Maintenance Often simpler for reporting teams Can be more complex across multiple related tables
Typical use Business dashboards and self-service analytics Complex hierarchies and certain governed data structures

Important: A snowflake schema is not automatically faster or more storage-efficient in every environment. The right choice depends on data volume, model design, refresh requirements, relationship behavior, and report workload.

7. Understanding Relationships in Power BI

Relationships connect tables using matching key columns. In a typical star schema, a dimension table has a one-to-many relationship with the fact table.

7.1 One-to-Many Relationship

A one-to-many relationship means that a key occurs once on the dimension side and can occur multiple times on the fact side.

For example:

DimProduct[ProductKey]  1 ---- *  FactSales[ProductKey]

One product can appear in many sales transactions. The Product dimension normally contains one row for each product key, while FactSales can contain many rows with the same key.

7.2 Single-Direction Filtering

In a standard star schema, dimension tables usually filter fact tables through single-direction relationships. Selecting a product category filters the relevant products and, through the relationship, the sales transactions used in calculations.

Single-direction filtering is often a good default because it reduces unexpected filter paths and makes the model easier to reason about.

7.3 Many-to-Many Relationships

A many-to-many relationship occurs when the joining key is not unique on either side. These relationships may be valid for some business scenarios, but they require careful design. A bridge table or an alternative dimensional model may provide more predictable behavior.

7.4 Avoiding Ambiguous Relationships

  • Check for duplicate keys in dimension tables.
  • Avoid unnecessary active relationship paths between the same tables.
  • Use inactive relationships only when the model has a clear analytical requirement.
  • Use bidirectional filtering selectively, not as a universal fix.
  • Test measures with slicers from different dimensions.

8. Building a Star Schema in Power BI

Follow these steps to create a star schema using Power BI Desktop.

Step 1: Import Data

  1. Open Power BI Desktop.
  2. Select Home > Get data.
  3. Choose a data source, such as Excel, SQL Server, CSV, or another supported connector.
  4. Load or transform the sales data and related dimension data.

Step 2: Clean Data in Power Query

Open Power Query Editor and prepare the tables before loading them into the model.

  • Remove unnecessary columns and rows.
  • Set correct data types.
  • Standardize column names.
  • Remove duplicates from dimension keys where appropriate.
  • Handle nulls and invalid values.
  • Ensure that the fact and dimension keys use compatible data types.
  • Split source data into logical fact and dimension queries when necessary.

Step 3: Create Dimension Tables

Create or prepare separate tables for products, customers, dates, and locations. Each dimension should provide descriptive attributes and a unique key for each entity at the intended grain.

For example, DimProduct may contain ProductKey, ProductName, Category, and Brand. ProductKey must uniquely identify each product row.

Step 4: Prepare the Fact Table

Prepare FactSales with the measures and foreign keys needed for reporting. Remove redundant descriptive fields if they are unnecessary in the fact table and already exist in dimensions.

Ensure that each transaction references valid dimension keys. Where appropriate, use a consistent unknown or not-applicable member to handle missing dimension references.

Step 5: Open Model View

  1. Select the Model view in Power BI Desktop.
  2. Arrange the fact table near the center of the model.
  3. Position dimension tables around it.
  4. Create relationships by dragging matching key columns or using Manage relationships.

Step 6: Configure Relationships

For each dimension-to-fact relationship, verify the following settings:

  • Cardinality: One-to-many, with the dimension on the one side.
  • Cross-filter direction: Usually Single.
  • Relationship status: Active when it should be the primary filtering path.
  • Key integrity: Dimension keys are unique and matching data types are compatible.

Step 7: Create Measures

Use DAX measures to calculate business metrics from the fact table.

Total Sales =
SUM(FactSales[SalesAmount])

Total Quantity =
SUM(FactSales[Quantity])

Total Cost =
SUM(FactSales[CostAmount])

Total Profit =
[Total Sales] - [Total Cost]

Profit Margin =
DIVIDE([Total Profit], [Total Sales], 0)

These measures respond to filters from related dimensions, assuming the relationships and filter paths are configured correctly.

Step 8: Build a Report

  • Add a card showing Total Sales.
  • Add a line chart showing sales by month.
  • Add a bar chart showing sales by product category.
  • Add slicers for year, region, and customer segment.
  • Verify that the visuals respond correctly to slicer selections.

9. Building a Snowflake Schema in Power BI

A snowflake model can be built by splitting dimension attributes into separate related tables. This is useful when attributes belong to distinct hierarchical entities and separating them provides a clear modeling or data-governance benefit.

Step 1: Identify Hierarchies

Review the source data for descriptive attributes that represent separate entities. A product hierarchy might contain Product, Subcategory, and Category. A geography hierarchy might contain City, State, and Country.

Step 2: Create Normalized Tables

Prepare separate queries or source tables for each entity.

DimProduct
-----------
ProductKey
ProductName
SubcategoryKey

DimSubcategory
--------------
SubcategoryKey
SubcategoryName
CategoryKey

DimCategory
-----------
CategoryKey
CategoryName

Step 3: Create the Relationships

Connect the hierarchy tables using their keys.

DimCategory[CategoryKey]
          1
          |
          *
DimSubcategory[CategoryKey]

DimSubcategory[SubcategoryKey]
          1
          |
          *
DimProduct[SubcategoryKey]

DimProduct[ProductKey]
          1
          |
          *
FactSales[ProductKey]

The exact direction and cardinality should match the actual key uniqueness and data structure. For this example, the category and subcategory keys are unique on their respective parent tables.

Step 4: Validate Filter Propagation

Build a visual with CategoryName and the Total Sales measure. Select a category and verify that only the corresponding products and sales transactions are included.

If the category does not filter sales as expected, check the relationship keys, cardinality, active status, filter direction, and data quality.

Step 5: Compare with a Star Schema

Evaluate whether the additional tables provide a meaningful advantage. If report authors frequently need category and subcategory attributes, a single DimProduct table containing ProductName, SubcategoryName, and CategoryName may be simpler for Power BI users.

10. Creating a Date Dimension

A dedicated date dimension is an important part of many Power BI dimensional models. It supports consistent time-based filtering and analysis.

10.1 Example Date Table Using DAX

DimDate =
ADDCOLUMNS(
    CALENDAR(
        DATE(2024, 1, 1),
        DATE(2027, 12, 31)
    ),
    "Year", YEAR([Date]),
    "Month Number", MONTH([Date]),
    "Month Name", FORMAT([Date], "MMMM"),
    "Quarter", "Q" & FORMAT([Date], "Q"),
    "Year Month", FORMAT([Date], "YYYY-MM")
)

This example creates a calendar covering 2024 through 2027. Adjust the start and end dates to match the reporting requirements.

10.2 Configure the Date Table

  1. Confirm that the Date column contains unique, contiguous dates at daily grain.
  2. Set the Date column's data type to Date.
  3. Use Table tools > Mark as date table and select the Date column where required.
  4. Create a one-to-many relationship from DimDate[Date] to the appropriate fact date column.
  5. Sort Month Name by Month Number so that months appear chronologically.
  6. Create fiscal year and fiscal period attributes if the business uses a non-calendar financial year.

A single date dimension can support several date roles, such as Order Date, Ship Date, and Delivery Date. Typically, one relationship is active while other relationships can be inactive and activated in specific measures with USERELATIONSHIP when appropriate.

11. Data Transformation for Star and Snowflake Schemas

Power Query is commonly used to prepare source data for dimensional modeling. Good transformation practices help maintain a reliable model.

11.1 Remove Unnecessary Columns

Keep only the fields required for analysis, relationships, calculations, and data validation. Reducing unnecessary columns can lower model size, particularly in Import mode.

11.2 Remove Duplicate Dimension Records

Before using a column as the one-side key, verify that each key appears only once. Do not simply remove duplicates if doing so would discard legitimate business records. Investigate why duplicates exist and define the correct entity grain first.

11.3 Use Consistent Data Types

Keys that participate in relationships should use compatible data types. For example, avoid joining a numeric ProductKey in one table to a text ProductKey in another without an intentional conversion.

11.4 Handle Missing Keys

Identify fact records that do not match a dimension. Depending on the business requirement, assign them to an explicit Unknown member or correct the source data. Unmatched records can lead to blank categories or unexpected totals in reports.

11.5 Use Query Folding Where Supported

When working with supported data sources, transformations that can be translated into source queries may improve refresh efficiency. Check query folding in Power Query and consider source-side views or transformations for large datasets when appropriate.

12. DAX Examples for Dimensional Models

12.1 Total Sales

Total Sales =
SUM(FactSales[SalesAmount])

Calculates the sum of sales amounts under the current filter context.

12.2 Sales by Product Category

Create a bar chart with DimProduct[Category] on the axis and Total Sales in Values. In a snowflake model, use the category attribute from the related category table instead.

12.3 Sales Year to Date

Sales YTD =
TOTALYTD(
    [Total Sales],
    DimDate[Date]
)

This measure calculates year-to-date sales using the date dimension. For a non-calendar financial year, configure the calculation to match the organization's fiscal calendar.

12.4 Previous Year Sales

Sales Previous Year =
CALCULATE(
    [Total Sales],
    SAMEPERIODLASTYEAR(DimDate[Date])
)

This measure compares the current date context with the equivalent period in the previous year, assuming a suitable date table and supported date range.

12.5 Year-over-Year Growth

YoY Growth % =
DIVIDE(
    [Total Sales] - [Sales Previous Year],
    [Sales Previous Year],
    0
)

Format this measure as a percentage. If the previous-year value is zero or missing, consider whether displaying zero or blank is more appropriate for the business scenario.

13. Performance Optimization in Power BI

A well-designed schema can improve model usability and help Power BI execute analytical queries efficiently. Performance also depends on data volume, storage mode, column cardinality, DAX complexity, source queries, and visual design.

13.1 Prefer a Clear Dimensional Model

Use a star schema as the default starting point for many Power BI semantic models. Keep the fact table at a well-defined grain and organize descriptive attributes in dimensions.

13.2 Reduce Unnecessary Columns

  • Remove unused identifiers and descriptive fields from the loaded model.
  • Hide technical keys from report users when they are not needed in report building.
  • Avoid importing high-cardinality text columns unless they are required.
  • Use appropriate data types and avoid unnecessary calculated columns.

13.3 Optimize Relationships

  • Use unique dimension keys wherever the model requires a one-to-many relationship.
  • Prefer simple, well-defined relationship paths.
  • Use bidirectional relationships only when there is a clear requirement.
  • Avoid ambiguous paths and unnecessary many-to-many relationships.

13.4 Optimize DAX Measures

Use measures for dynamic aggregations and keep expressions understandable. Test complex measures with Performance Analyzer and other appropriate diagnostic tools when reports are slow.

13.5 Use Aggregations and Incremental Refresh When Appropriate

For large datasets, aggregation tables, incremental refresh, source optimization, and suitable storage modes may help. Choose these techniques based on actual workload and refresh requirements rather than assuming every model needs them.

14. Common Mistakes and Troubleshooting

14.1 Duplicate Dimension Keys

Problem: Power BI cannot create the intended one-to-many relationship because the dimension key contains duplicates.

Solution: Inspect duplicate rows in Power Query or the source system. Confirm the dimension grain and correct the data model before creating the relationship.

14.2 Incorrect Data Types

Problem: Relationship columns use incompatible data types or values do not match as expected.

Solution: Standardize data types, remove unwanted spaces from text keys where applicable, and verify that key values match.

14.3 Unexpected Blank Categories

Problem: A visual displays a blank category even though the dimension appears complete.

Solution: Check for missing or unmatched foreign keys in the fact table. Review null values and relationship integrity.

14.4 Incorrect Sales Totals

Problem: A measure returns unexpected totals when multiple dimensions are used.

Solution: Check the fact table grain, relationship cardinality, filter direction, duplicate fact rows, and measure logic. Verify the result against a known source total.

14.5 Category Does Not Filter Sales

Problem: Selecting a product category does not change the sales chart.

Solution: Verify the category-to-subcategory and subcategory-to-product relationships in a snowflake model. Then verify the product-to-sales relationship, active status, and filter propagation.

14.6 Too Many Tables and Relationships

Problem: The model becomes difficult to understand after normalization.

Solution: Evaluate whether descriptive hierarchy tables should be combined into a denormalized dimension for reporting. Keep separate tables when they provide a meaningful benefit.

14.7 Incorrect Month Sorting

Problem: Month names appear alphabetically rather than chronologically.

Solution: Select Month Name and choose Sort by column, then select Month Number.

15. Practical Project: Retail Sales Data Model

Build a retail sales model using sample transaction data. The project will help you understand how the choice between a star and snowflake schema affects report design.

15.1 Business Requirement

A retail company wants to analyze revenue, quantity sold, profit, product category performance, customer segments, and monthly sales trends.

15.2 Required Tables

  • FactSales
  • DimDate
  • DimProduct
  • DimCustomer
  • DimStore
  • DimSubcategory and DimCategory for the snowflake variation

15.3 Project Tasks

  1. Import the sales and reference data into Power BI.
  2. Clean the data using Power Query.
  3. Identify the grain of FactSales.
  4. Build a star schema with direct dimension-to-fact relationships.
  5. Create measures for Total Sales, Total Quantity, Total Cost, and Total Profit.
  6. Create a dashboard showing sales by month, category, region, and customer segment.
  7. Duplicate the model design for a snowflake experiment by separating product categories into related tables.
  8. Compare usability, relationship complexity, refresh behavior, and report performance.
  9. Document which design best fits the reporting requirements and why.

15.4 Expected Output

The finished report should allow users to filter sales by date, product, customer, and location. Measures should return consistent results across the star and snowflake versions when the underlying business data and filtering requirements are equivalent.

16. Best Practices for Building Star and Snowflake Schemas

  • Define the business requirements before creating tables.
  • Establish the grain of each fact table.
  • Keep fact measurements separate from descriptive dimension attributes where practical.
  • Use unique dimension keys and consistent relationship data types.
  • Prefer a star schema for straightforward self-service reporting unless normalization provides a clear benefit.
  • Use snowflake structures when separate hierarchy tables improve governance, reuse, or maintainability.
  • Build a proper date dimension for time-based analysis.
  • Hide technical keys from report users when appropriate.
  • Validate totals against trusted source data.
  • Test report filtering and DAX measures with realistic scenarios.
  • Document the purpose of each table and relationship.
  • Measure performance instead of assuming one schema is always faster.

17. Interview Questions and Answers

Q1. What is a star schema?

Answer: A star schema is a dimensional model with a central fact table connected directly to dimension tables. It is widely used in business intelligence because its structure is relatively simple to understand and query.

Q2. What is a snowflake schema?

Answer: A snowflake schema is a dimensional model in which dimensions are normalized into multiple related tables, often to represent hierarchies or reduce repeated descriptive attributes.

Q3. What is the main difference between star and snowflake schemas?

Answer: In a star schema, dimensions are generally denormalized and connect directly to the fact table. In a snowflake schema, some dimensions are divided into additional related tables.

Q4. Why is a star schema often recommended in Power BI?

Answer: It provides clear relationships, simpler filtering paths, easier report authoring, and a logical separation between facts and descriptive dimensions.

Q5. What is a fact table?

Answer: A fact table stores business events or observations, numeric measurements, and foreign keys to dimensions. Examples include sales transactions, inventory snapshots, and financial transactions.

Q6. What is a dimension table?

Answer: A dimension table contains descriptive attributes used to categorize, filter, and group facts, such as product category, customer segment, or date.

Q7. What is grain in dimensional modeling?

Answer: Grain defines what one row in a fact table represents. A clearly defined grain helps prevent double counting and inconsistent aggregations.

Q8. What is a one-to-many relationship?

Answer: It connects a unique key on the dimension side to multiple matching foreign-key values on the fact side.

Q9. Does a snowflake schema always improve performance?

Answer: No. Its effect depends on the model, source, storage mode, query patterns, and data characteristics. Additional relationships can increase complexity, so performance should be tested.

Q10. When should you use a snowflake schema?

Answer: Use it when separate hierarchy tables or shared reference attributes provide a meaningful benefit, such as clearer governance or reduced duplication. Avoid extra normalization that makes the semantic model unnecessarily complicated.

Q11. Why should dimension keys be unique?

Answer: Uniqueness enables the intended one-to-many relationship and ensures that each dimension key identifies one dimension record.

Q12. What is the role of Power Query?

Answer: Power Query imports and transforms source data, cleans columns, standardizes types, removes unnecessary data, and prepares fact and dimension tables for modeling.

Q13. What is a surrogate key?

Answer: A surrogate key is a generated identifier used to uniquely identify a dimension record independently of the original business key.

Q14. How do you troubleshoot incorrect totals?

Answer: Verify the fact grain, check for duplicate records, validate relationships and filter directions, review DAX calculations, and compare the output against trusted source totals.

Q15. Why is a date dimension important?

Answer: It provides consistent calendar attributes and supports time intelligence, date filtering, period comparisons, and year-to-date calculations.

18. Exercises for Practice

  1. Explain the difference between a fact table and a dimension table using a sales example.
  2. Design a star schema for an online shopping platform.
  3. Convert the product dimension in your model into a snowflake structure with category and subcategory tables.
  4. Create a date dimension with year, quarter, month number, and month name.
  5. Create a one-to-many relationship between DimProduct and FactSales.
  6. Write DAX measures for total sales, total quantity, and total profit.
  7. Build a report with a product category slicer and verify its effect on sales.
  8. Introduce a duplicate dimension key in a test copy and investigate the relationship error.
  9. Compare the two models for clarity, maintainability, and performance.

19. Quick Revision Checklist

  • Understand dimensional modeling and its purpose.
  • Know the difference between fact and dimension tables.
  • Define the grain of each fact table.
  • Understand star and snowflake schema structures.
  • Know how normalization affects dimension design.
  • Create one-to-many relationships in Power BI.
  • Use single-direction filtering as a sensible default.
  • Prepare data with Power Query.
  • Create and configure a date dimension.
  • Write basic DAX measures and test their filter behavior.
  • Identify duplicate keys, unmatched records, and ambiguous relationships.
  • Choose the schema that best meets reporting and governance requirements.

20. Conclusion

Star and snowflake schemas are foundational concepts for building reliable Power BI data models. A star schema keeps dimensions relatively simple and connects them directly to a central fact table, making it a strong default for many reporting scenarios. A snowflake schema separates selected dimension attributes into additional tables, which can be useful for complex hierarchies, shared reference data, and governance requirements.

To build an effective model, define the fact table grain, prepare clean dimension keys, configure relationships carefully, create reusable DAX measures, and test the results against trusted business data. Choose between star and snowflake designs based on usability, data structure, maintainability, and measured performance.

Learn more: Explore the Microsoft Power BI Training course and register for a course demo at JustAcademy.

whatsapp