11.8 Modelling Best Practices
Start with a problem
Rani inherits a slow model: Autodetect relationships created odd links, Auto date/time is on, IDs are summed, and unused columns are loaded.
Explain simply
A short checklist keeps models small, fast and hard to misuse: star schema, single-direction one-to-many, one marked Date table, hidden keys, no unused columns, measures for aggregation, friendly names and formats.
Show the data
| Check | Before | After |
|---|---|---|
| Schema | One flat table | Star: Orders + DarkStore + Date |
| Auto date/time | On (hidden date table per date column) | Off; one marked Date table |
| DarkStore columns | 7 (incl. Latitude, Longitude, Manager Email) | 4 needed (Store, City, Region, Manager) |
| Order ID | Summed | Summarize by None |
About this data: This table uses columns: Check, Before, After. This table uses columns: Measure, Value. This table uses columns: Wrong result, Reason, Correction. Values shown are the lesson examples already on this page (not a new dataset).
Fictional sample data. Practice file: visuals_orders_apr_may_2026.csv, dark_stores_maharashtra.csv (source: src/practice/).
Demonstrate
- Turn off Autodetect new relationships and Auto date/time (File › Options › Current file › Data load).
-
Rebuild as a star: DarkStore 1 → * Orders, Date 1 → * Orders, both single direction.
Your result should look like this:
Relationships 2 -
Power Query › DarkStore › remove columns not used by any visual (keep Latitude/Longitude only if you build a map, Manager Email only if RLS needs it).
Your result should look like this:
DarkStore columns Store, City, Region, Manager -
Hide Orders[Store] and Orders[Order Date]; users filter with DarkStore and Date.
- Replace calculated-column totals with measures; put them in display folders with formats.
Show the result
Your result should look like this (fictional sample):
| Measure | Value |
|---|---|
| Total Sales | ₹2,100 |
| Total Orders | 8 |
| AOV (delivered) | ₹300 |
| Avg Delivery (min) | 11.0 |
| Cancellation % | 12.5% |
Explain what happened
The numbers stay the same; only the model is cleaner. Fewer columns and no hidden date tables make the file smaller, and single-direction relationships keep filter paths predictable.
Explore further
- Use integer keys where possible; long text keys compress poorly.
Detailed reference for this lesson:
- Use a star schema: facts in the centre, dimensions around.
- Use one-to-many, single-direction relationships wherever possible.
- Always build a dedicated, marked date table and turn off Auto date/time.
- Hide foreign keys in the fact table (users should filter using the dimension columns).
- Remove unused columns and rows in Power Query – smaller model, faster report.
- Use integer keys and correct data types; avoid high-cardinality text keys where possible.
- Prefer measures over calculated columns for aggregations.
- Give tables and columns business-friendly names (
Customer Name, notcust_nm). - Set Summarize by = None for numeric attributes like Year and IDs.
- Keep a consistent number format and put measures in display folders with descriptions.
Mini-exercise
Load the Blinkit tables. Build the star schema (रचना), create the DAX date table above, mark it as a date table, set Month Name to sort by Month Number, create the inactive Delivered Date relationship, and hide all ID columns in Orders.
Ravindra Bagale's Tip
Friends, many students let Autodetect relationships create links on columns with similar names, like "ID" to "ID". Turn it off for new projects (File › Options › Data Load) and create each relationship deliberately. Review Model view after every new table. Clear?
Ravindra Bagale's Tip – मराठी
मित्रांनो, बरेच students Autodetect relationships ला सारख्या नावांच्या columns वर links बनवू देतात, जसं "ID" ते "ID". नव्या projects साठी ते बंद करा (File › Options › Data Load) आणि प्रत्येक relationship विचारपूर्वक स्वतः बनवा. प्रत्येक नवा table जोडल्यानंतर Model view चेक करा. समजलं का?
Ravindra Bagale's Tip – हिंदी
दोस्तों, बहुत से students Autodetect relationships को मिलते-जुलते नाम वाले columns पर links बनाने देते हैं, जैसे "ID" से "ID". नए projects के लिए इसे बंद करो (File › Options › Data Load) और हर relationship सोच-समझकर ख़ुद बनाओ. हर नई table के बाद Model view check करो. समझ आया?
Fix common mistakes
| Wrong result | Reason | Correction |
|---|---|---|
| A strange ID ↔ ID relationship appears | Autodetect relationships | Turn it off; create each relationship yourself |
| The file is large for a small dataset | Auto date/time and unused columns | Turn it off; remove columns |
| The same logic sits in three calculated columns | Columns used for aggregation | Use measures |
Practise independently
Practice task
Count the relationships in the star model built in this module (Orders, DarkStore, Date) and give their direction.
Hints
- One per dimension.
Solution
2: DarkStore[Store] 1 → * Orders[Store] and Date[Date] 1 → * Orders[Order Date], both single direction. Total Sales stays ₹2,100.
Think like a professional
Keep a one-page model checklist in the project folder and tick it before every publish.