Designing and Building a SQL Data Warehouse with SSIS and Power BI
A data warehouse is a central store of structured, historical data designed for reporting and analysis. Unlike an operational database — which is optimised for recording transactions as they happen — a data warehouse is optimised for asking questions across large volumes of data. This guide walks you through the full process: designing the warehouse schema, building SSIS packages to extract, transform and load data, and creating a Power BI semantic model with reports. The worked example follows Snips Housing Association, a fictional organisation managing 4,200 properties across three regions, as they consolidate data from three separate systems into a single reporting warehouse.
What you will learn
- What a data warehouse is and how it differs from an operational database
- How to design a star schema with fact and dimension tables
- How to create the warehouse database and tables in SQL Server
- How to build SSIS packages to extract, transform and load data from source systems
- How to handle slowly changing dimensions and incremental loads
- How to build a Power BI semantic model connecting to the warehouse
- How to write DAX measures for KPIs and create interactive reports
- Common pitfalls and best practices at each stage
The scenario: Snips Housing Association
Snips Housing Association manages 4,200 properties across three regions: North, Midlands and South. Their data lives in three separate systems that do not talk to each other:
Orchard Housing (SQL Server)
The core housing management system. Holds tenancy records, rent accounts, property details and repair orders.
Civica Finance (Oracle)
The finance system. Holds invoices, payments, budget codes and cost centre data.
Excel spreadsheets (SharePoint)
The voids and lettings team maintain a weekly spreadsheet tracking empty properties, re-let times and applicant waiting lists.
The business problem
The Head of Performance needs a single dashboard showing rent collection rates, void turnaround times and repair completion rates — all in one place, updated weekly. Currently this takes two analysts three days to produce manually. The solution is a SQL data warehouse that pulls from all three sources, with Power BI reports on top.
The three-layer architecture
Staging
Raw copies of source data. No transformation. Truncate and reload each run.
Integration
Cleaned, conformed and transformed data. Slowly changing dimensions handled here.
Presentation
Star schema. Fact and dimension tables. This is what Power BI connects to.
Understanding the data warehouse architecture
A data warehouse sits between your source systems and your reporting tools. Source systems (like Orchard and Civica) are optimised for recording data quickly and accurately. They use normalised schemas with many tables and foreign keys to avoid duplication. This is great for transactions but slow for reporting — a query asking 'how much rent did we collect by region last quarter' might need to join fifteen tables.
A data warehouse uses a denormalised schema — typically a star schema — that is optimised for exactly those kinds of analytical queries. Data is pre-joined, pre-aggregated where appropriate, and structured so that a reporting tool like Power BI can query it efficiently without needing to understand the complexity of the source systems.
The three-layer architecture used in this guide is: a Staging layer (raw copies of source data, loaded as-is), an Integration layer (cleaned, transformed and conformed data), and a Presentation layer (the star schema that Power BI connects to). Some organisations combine staging and integration, but keeping them separate makes debugging much easier.
Tip: Think of staging as your safety net. If a transformation goes wrong, you can re-run it from staging without going back to the source system. Never transform data in the staging layer — just copy it.
Designing the star schema
A star schema has two types of table: fact tables and dimension tables. A fact table holds measurable events — rent payments, repair orders, void periods. Each row represents one event and contains numeric measures (amount paid, days to complete) plus foreign keys pointing to dimension tables. Dimension tables hold the descriptive context — who, what, where, when.
For Snips, the three key business processes map to three fact tables: FactRentPayment (one row per rent payment transaction), FactRepairOrder (one row per repair raised and completed), and FactVoidPeriod (one row per void period from vacancy to re-let). These share dimension tables: DimProperty, DimTenant, DimDate, DimRegion, DimRepairCategory, and DimCostCentre.
The DimDate table is particularly important. Rather than storing dates as raw datetime values in your fact tables, you store a DateKey (an integer like 20250115 for 15 January 2025) and join to DimDate which has columns for Day, Month, MonthName, Quarter, FinancialYear, IsWeekend, IsPublicHoliday and so on. This makes time-based analysis in Power BI much faster and more flexible.
Grain is the most important design decision. The grain of a fact table is the most atomic level of detail it stores. FactRentPayment has a grain of one row per payment transaction per tenancy per week. You cannot mix grains in a single fact table — if you need weekly summaries and individual transactions, create two separate fact tables or use Power BI measures to aggregate.
Tip: Write down the grain of each fact table before you write a single line of SQL. If you cannot describe it in one sentence, your design is not clear enough yet.
Creating the warehouse database and tables in SQL Server
Create the warehouse database in SQL Server Management Studio (SSMS). Use three schemas to separate the layers: stg (staging), int (integration) and pres (presentation). This keeps the object browser clean and makes permissions easier to manage — ETL service accounts need write access to stg and int, but reporting accounts only need read access to pres.
The DimDate table is populated once using a T-SQL script that generates one row per day for a date range (typically 1 April 2015 to 31 March 2035 for a UK housing association using financial years). The script calculates all derived columns — quarter, financial year, week number, day name — so you never need to calculate them in Power BI. A 20-year DimDate table has around 7,300 rows and takes under a second to generate.
Surrogate keys are integer identity columns added to every dimension table (e.g. PropertyKey, TenantKey). They are different from the natural keys used in source systems (e.g. PropertyRef, TenancyID). Using surrogate keys insulates the warehouse from changes in source systems — if Orchard changes its property reference format, only the ETL mapping needs updating, not every fact table that references properties.
For the Snips warehouse, the key table definitions are: DimProperty (PropertyKey, PropertyRef, Address, PropertyType, Bedrooms, RegionKey, LocalAuthority, EPC_Rating, IsActive), DimTenant (TenantKey, TenantRef, TenantName, TenancyStartDate, TenancyType, IsCurrentTenant), DimDate (DateKey, FullDate, DayOfWeek, DayName, WeekNumber, Month, MonthName, Quarter, CalendarYear, FinancialYear, FinancialQuarter, IsWeekend, IsPublicHoliday), FactRentPayment (RentPaymentKey, DateKey, PropertyKey, TenantKey, CostCentreKey, WeeklyRentCharge, AmountPaid, ArrearsBalance, PaymentMethod, SourceSystem).
Tip: Always add a LoadDate column (datetime, default GETDATE()) and a SourceSystem column (varchar) to every staging and fact table. When something goes wrong at 9am on a Monday, you will be very glad you can see exactly when each row was loaded and where it came from.
Building SSIS packages: extract and stage
SQL Server Integration Services (SSIS) is Microsoft's ETL tool, included with SQL Server. You build packages in Visual Studio with the SSIS extension (or SQL Server Data Tools). Each package is a workflow of tasks connected by precedence constraints — green arrows mean 'run next if this succeeded', red arrows mean 'run next if this failed', blue arrows mean 'run next regardless'.
The first set of packages extracts data from source systems into the staging layer. For Orchard (SQL Server), use an OLE DB Source connected to the Orchard database, an OLE DB Destination pointing to stg.RentAccounts. For Civica (Oracle), use an ADO.NET Source with the Oracle provider. For the Excel spreadsheets, use an Excel Source component — but be aware that Excel sources are fragile; if the column order changes in the spreadsheet, the package breaks. Consider asking the voids team to export to CSV instead.
Use a truncate-and-reload pattern for staging tables. At the start of each package, add an Execute SQL Task that runs TRUNCATE TABLE stg.RentAccounts. This ensures staging always contains a clean, current copy of the source data. Do not use DELETE — it is slower and logs every row deletion. Staging tables do not need to track history; that is what the integration and presentation layers are for.
For the Snips rent accounts extract, the Data Flow Task contains: an OLE DB Source querying SELECT TenancyRef, PropertyRef, WeekEndingDate, RentCharge, AmountReceived, Balance, PaymentMethod FROM orchard.dbo.RentLedger WHERE WeekEndingDate >= DATEADD(week, -2, GETDATE()); a Derived Column transformation adding LoadDate = GETDATE() and SourceSystem = 'Orchard'; and an OLE DB Destination inserting into stg.RentPayments.
Tip: Use package parameters for connection strings and date ranges rather than hardcoding them. A parameter called @[User::ExtractFromDate] can be set at runtime by the SQL Agent job, making it easy to re-run a specific date range without editing the package.
Building SSIS packages: transform and load dimensions
Dimension loading is more complex than staging because you need to handle slowly changing dimensions (SCDs). A slowly changing dimension is a dimension where attributes change over time — a tenant moves property, a property is reclassified, a region boundary changes. The question is: do you overwrite the old value (Type 1 SCD), keep a history of changes (Type 2 SCD), or store both current and previous values (Type 3 SCD)?
For Snips, DimProperty uses Type 2 SCD for PropertyType and RegionKey (because historical reports need to show the region a property was in at the time of the transaction, not its current region). DimTenant uses Type 1 SCD for contact details (we do not need a history of phone number changes) but Type 2 for TenancyType (because a tenancy can change from starter to secure, and this affects performance metrics).
SSIS has a built-in Slowly Changing Dimension transformation, but it is notoriously slow for large datasets. A faster approach is to use a Lookup transformation to check whether the incoming row already exists in the dimension, then route new rows to an OLE DB Destination (insert) and changed rows to an OLE DB Command (update for Type 1) or a second OLE DB Destination with an additional insert plus an update to set IsActive = 0 on the old row (for Type 2).
The DimProperty load package for Snips works as follows: OLE DB Source reads from stg.Properties. A Lookup checks pres.DimProperty on PropertyRef where IsActive = 1. No-match rows (new properties) go to an OLE DB Destination inserting into pres.DimProperty with IsActive = 1, EffectiveFrom = GETDATE(), EffectiveTo = NULL. Match rows where attributes have changed go to an OLE DB Command that sets IsActive = 0 and EffectiveTo = GETDATE() on the existing row, then to a second OLE DB Destination inserting the new version. Match rows with no changes are discarded.
Tip: Add a row count to every Data Flow Task using a Row Count transformation connected to a package variable. Log these counts to a control table (ETL_PackageLog) with the package name, start time, end time, rows extracted, rows inserted and rows rejected. This makes it easy to spot when a load is unexpectedly small — which often means a source system issue rather than an ETL bug.
Building SSIS packages: load fact tables
Fact table loading is generally simpler than dimension loading because fact rows are immutable — you do not update them, you only insert new ones. The key challenge is the lookup step: converting natural keys from the source system into surrogate keys from the dimension tables.
The FactRentPayment load package reads from stg.RentPayments and performs four Lookup transformations in sequence: Lookup PropertyKey from pres.DimProperty on PropertyRef where IsActive = 1; Lookup TenantKey from pres.DimTenant on TenancyRef where IsCurrentTenant = 1; Lookup DateKey from pres.DimDate on FullDate matching the WeekEndingDate; Lookup CostCentreKey from pres.DimCostCentre on CostCentreCode.
Configure each Lookup to redirect no-match rows to a flat file destination (an error log) rather than failing the package. A rent payment for a property that does not exist in DimProperty should not crash the entire load — it should be logged so the data quality team can investigate. Use a Union All transformation after the lookups to combine matched rows before the final OLE DB Destination.
For incremental loading, add a high-water mark pattern. Store the last successfully loaded WeekEndingDate in a control table (ETL_HighWaterMark). At the start of the package, read this value into a package variable using an Execute SQL Task. Use the variable in the source query: WHERE WeekEndingDate > ? (passing the variable as a parameter). After a successful load, update the high-water mark. This means each weekly run only processes new data rather than reloading everything.
Tip: Use the Cache transformation for frequently-used lookups like DimDate and DimRegion. These tables are small and rarely change — caching them in memory at the start of the package avoids thousands of individual database round-trips and can reduce fact load times by 60–70%.
Scheduling and monitoring with SQL Server Agent
Once your packages are working, deploy them to the SSIS Catalog (SSISDB) on the SQL Server instance. The SSIS Catalog stores packages, environments (for connection string parameters) and execution logs. Right-click the SSISDB node in SSMS and choose 'Create Catalog' if it does not already exist.
Create a SQL Server Agent job with multiple steps: Step 1 runs the staging packages (all source extracts in parallel if possible, using separate job steps); Step 2 runs the dimension load packages (in dependency order — DimRegion before DimProperty, DimDate is pre-populated and does not need reloading); Step 3 runs the fact load packages. Set each step to fail the job on error so that a failed staging load does not result in fact tables being loaded from stale staging data.
Schedule the job to run every Monday at 6am for Snips, giving the voids team time to upload their Friday spreadsheet over the weekend. Add an operator (an email address) to the job so that SQL Agent sends an alert if any step fails. The SSIS Catalog's built-in execution reports in SSMS show the duration and row counts for every package execution, making it easy to spot performance regressions.
Tip: Create a simple monitoring view in the warehouse: CREATE VIEW dbo.vw_ETL_LastRun AS SELECT PackageName, MAX(StartTime) AS LastRun, MAX(RowsInserted) AS RowsInserted, MAX(Status) AS Status FROM ETL_PackageLog GROUP BY PackageName. Connect Power BI to this view for a live ETL health dashboard alongside your business reports.
Building the Power BI semantic model
A semantic model (formerly called a dataset in Power BI) is the layer between your data warehouse and your reports. It defines the relationships between tables, creates calculated columns and measures, sets up hierarchies, and controls what report authors can see and do. A well-designed semantic model means report authors can build new reports without needing to understand SQL or the warehouse schema.
In Power BI Desktop, connect to the warehouse using Get Data > SQL Server. Enter the server name and database name, and choose DirectQuery or Import mode. For Snips, use Import mode — the warehouse is updated weekly, so there is no benefit to DirectQuery's live querying, and Import mode is significantly faster for report rendering. Select all tables from the pres schema.
In the Model view, verify that Power BI has correctly detected the relationships. It should have detected: FactRentPayment[DateKey] → DimDate[DateKey] (many-to-one), FactRentPayment[PropertyKey] → DimProperty[PropertyKey] (many-to-one), FactRentPayment[TenantKey] → DimTenant[TenantKey] (many-to-one), and so on. Check that all relationships are set to Single cross-filter direction — bidirectional filtering can cause ambiguous results in a star schema and should be avoided unless you have a specific reason.
Hide all key columns (DateKey, PropertyKey, TenantKey etc.) from report view — report authors should never need to see surrogate keys. Hide the individual fact table columns that will only ever be used inside measures (WeeklyRentCharge, AmountPaid, ArrearsBalance). This keeps the field list clean and prevents report authors from accidentally dragging raw measures onto a visual without the correct aggregation context.
Tip: Create a dedicated 'Measures' table in your semantic model: in Power BI Desktop, go to Modelling > New Table and enter Measures = ROW("Placeholder", BLANK()). Put all your DAX measures in this table and hide the Placeholder column. This keeps measures separate from data columns and makes the model much easier to navigate.
Writing DAX measures for KPIs
DAX (Data Analysis Expressions) is the formula language used in Power BI semantic models. Measures are DAX calculations that are evaluated in the context of a visual — the same measure can show total rent collected for the whole organisation, or broken down by region, or filtered to a single property, depending on what filters and slicers the report user has applied.
The three core KPIs for Snips are: Rent Collection Rate (percentage of rent charged that was actually collected), Average Void Turnaround (average days from a property becoming vacant to a new tenancy starting), and Repair Completion Rate (percentage of repairs completed within the target time for their priority category). Each requires a DAX measure.
Rent Collection Rate: Total Rent Charged = SUM(FactRentPayment[WeeklyRentCharge]). Total Rent Collected = SUM(FactRentPayment[AmountPaid]). Rent Collection Rate = DIVIDE([Total Rent Collected], [Total Rent Charged], 0). The DIVIDE function handles division by zero gracefully, returning 0 (the third argument) rather than an error. Format this measure as a percentage.
Average Void Turnaround: Void Days = SUM(FactVoidPeriod[VoidDays]). Void Count = COUNTROWS(FactVoidPeriod). Average Void Days = DIVIDE([Void Days], [Void Count], 0). For a target-based measure: Voids Within Target = CALCULATE(COUNTROWS(FactVoidPeriod), FactVoidPeriod[VoidDays] <= 28). Void Target Achievement = DIVIDE([Voids Within Target], [Void Count], 0).
Time intelligence measures use DimDate to enable year-on-year comparisons. Rent Collected PY (prior year) = CALCULATE([Total Rent Collected], SAMEPERIODLASTYEAR(DimDate[FullDate])). Rent Collection YoY Change = [Total Rent Collected] - [Rent Collected PY]. Rent Collection YoY % = DIVIDE([Rent Collection YoY Change], [Rent Collected PY], 0). These measures automatically respond to date slicers in reports.
Tip: Use CALCULATE sparingly and understand what it does: it evaluates a measure in a modified filter context. Every time you write CALCULATE, ask yourself 'what filter am I adding, removing or changing?' If you cannot answer that question clearly, the measure will produce unexpected results. The ALLEXCEPT and REMOVEFILTERS functions are your tools for controlling which filters CALCULATE preserves.
Building the Power BI reports
The Snips performance dashboard has three report pages: Executive Summary (one-page overview of all three KPIs with trend lines and regional breakdown), Rent Collection Detail (drill-through page showing collection rates by property, tenant type and payment method), and Repairs Performance (repair completion rates by category, priority and contractor).
The Executive Summary page uses a card visual for each KPI (Rent Collection Rate, Average Void Days, Repair Completion Rate), a line chart showing each KPI over the last 12 months using DimDate[MonthName] on the X axis, and a matrix visual showing all three KPIs broken down by DimRegion[RegionName]. A date slicer using DimDate[FinancialYear] lets users switch between financial years.
Use conditional formatting on the KPI cards to show green when the target is met and red when it is not. In Power BI Desktop, select the card visual, go to Format > Callout value > Font colour > Conditional formatting. Create a rule: if the measure value is greater than or equal to the target value, colour green (hex #0D9488); otherwise colour red (hex #940d19). This gives the Head of Performance an instant RAG status at a glance.
Publish the report to Power BI Service and set up a scheduled refresh to run every Monday at 8am — two hours after the SQL Agent job completes the warehouse load. In the Power BI Service dataset settings, configure the data source credentials for the SQL Server warehouse. Set up a Power BI workspace for the Snips performance team and share the dashboard with the relevant users using row-level security if different regions should only see their own data.
Tip: Create a separate 'Template' page in your Power BI report with your organisation's colour palette, logo placement and standard font sizes. Duplicate this page when creating new report pages to ensure consistency. Hide the template page before publishing so report users do not see it.
Row-level security in the semantic model
Row-level security (RLS) restricts which rows of data a user can see based on their identity. For Snips, regional managers should only see data for their region. RLS is defined in the semantic model using DAX filter expressions, then enforced in Power BI Service when users view reports.
In Power BI Desktop, go to Modelling > Manage Roles. Create a role called RegionalManager. Add a table filter on DimRegion: [RegionManagerEmail] = USERPRINCIPALNAME(). USERPRINCIPALNAME() returns the email address of the currently logged-in user. This means the filter automatically applies the correct region for whoever is viewing the report, without needing a separate role per region.
For this to work, DimRegion must have a RegionManagerEmail column populated with the email addresses of the regional managers. Add this column to the DimRegion table in the warehouse and populate it via the SSIS dimension load. After publishing to Power BI Service, go to the dataset settings, select Security, and assign the RegionalManager role to the relevant users or Active Directory groups.
Tip: Always test RLS using the 'View as' feature in Power BI Desktop (Modelling > View as) before publishing. Test with your own email address and with a test account for each role. A common mistake is forgetting that RLS on DimRegion will only filter FactRentPayment if there is an active relationship between them — check the model view carefully.
Common pitfalls and how to avoid them
Pitfall 1 — Loading data without understanding it. Before writing a single SSIS package, spend time with the source system owners understanding the data. What does a NULL in the Balance column mean — no balance, or data not available? Are there known data quality issues? What is the correct grain of the source table? Assumptions made at this stage are very expensive to fix later.
Pitfall 2 — Ignoring time zones. If your source systems record timestamps in local time and your warehouse is on a server in a different time zone (or if daylight saving time is involved), you will get duplicate or missing rows around the clock change. Always store UTC in the warehouse and convert to local time in Power BI using a calculated column or measure.
Pitfall 3 — Bidirectional relationships in Power BI. It is tempting to set all relationships to bidirectional so that filters flow in both directions. This causes ambiguous filter paths in a star schema and produces incorrect results. Use single-direction relationships and CROSSFILTER in DAX when you genuinely need bidirectional filtering for a specific measure.
Pitfall 4 — Putting business logic in reports instead of the semantic model. If five different reports all need to calculate Rent Collection Rate, do not write the DAX in each report. Define it once as a measure in the semantic model. If the business changes the definition of the KPI, you update it in one place and all reports automatically reflect the change.
Pitfall 5 — Not documenting the model. A data warehouse with no documentation is a liability. At minimum, document the grain of each fact table, the source of each column, the logic of each SSIS transformation, and the definition of each DAX measure. A simple Word document or SharePoint page is fine. The person who inherits this system in three years will thank you.
Tip: Build a data dictionary as you go, not after the fact. Create a table in the warehouse called dbo.DataDictionary with columns for TableName, ColumnName, DataType, Description, SourceSystem, SourceColumn and LastUpdated. Populate it as you create each table. It takes five minutes per table and saves hours of reverse-engineering later.
Where to go next
Now you have a working data warehouse and Power BI reports, the next step is to explore DAX further — particularly time intelligence functions and advanced filtering patterns.
DAX Basics for Power BI →