In short
Time to model a real retail dataset end to end: a sales fact and product, store, customer and date dimensions, connected the right way. This becomes the base for every DAX lesson that follows.
A project turning a retail dataset into a clean star schema with a sales fact table, product, store, customer and date dimensions, and correct relationships.

Think of it like this
Setting up a warehouse
Before goods can move fast, a warehouse needs labelled racks, one aisle per type and a clear dispatch bay in the centre. Modeling is that setup work. Once it's right, every order (every visual) gets picked quickly and correctly.
The big ideas
What you need to know
One fact, four dimensions
Sales in the centre, with Date, Product, Store and Customer around it.
Unique keys
Every dimension key is unique and matches the fact key's data type.
Prove it's clean
Duplicate key and orphan row checks should all show 0.
Explain the grain
Be ready to say in an interview: one row of Sales is one product on one bill.
How it works
Project plan
- 1
Profile the data
Load a flat retail file, like a chain of stores across Mumbai, Bengaluru and Jaipur, and note the grain of each row.
- 2
Build dimensions
Reference the flat query to make Product, Store and Customer with unique keys.
- 3
Build the fact
Keep bill number, date, keys, quantity, amount and cost in Sales.
- 4
Add a Date table
Create a Date table covering every financial year in the data and mark it.
- 5
Relate and check
Create one-to-many single-direction relationships and run the health-check measures.
- 6
Tidy and document
Hide keys, add base measures, and take a Model view screenshot for your portfolio.
See it in code
Walk through the code
1Total Sales = SUM ( Sales[Amount] )2 3Total Cost = SUM ( Sales[Cost] )4 5Gross Margin % = DIVIDE ( [Total Sales] - [Total Cost], [Total Sales] )6 7Bills = DISTINCTCOUNT ( Sales[BillNo] )8 9Avg Bill Value = DIVIDE ( [Total Sales], [Bills] )10 11Orphan Store Rows =12COUNTROWS ( FILTER ( Sales, ISBLANK ( RELATED ( Store[StoreKey] ) ) ) )1/3Revenue, cost and margin. The margin is a ratio of totals, so it's correct at every level.
Starter measures and one health check to prove the model works. Test them in a matrix by Store[City] and 'Date'[Month].
Save yourself the pain
Common mistakes
Oops
Using COUNTROWS ( Sales ) as the number of bills.
Do this instead
Sales has one row per product line. Use DISTINCTCOUNT ( Sales[BillNo] ) for bills.
Oops
Building visuals before checking relationships.
Do this instead
Run the health checks first. A wrong model makes every visual wrong in a way that's hard to spot.
Your mission
Ship the star schema
Quick check
In your retail model, each Sales row is one product on one bill. How do you count bills?
Go deeper
- 1Use a public dataset such as Microsoft's Contoso or AdventureWorks sample.
- 2Screenshot the final Model view for your portfolio.
- 3Write a short note explaining the grain and each relationship.
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.