<DataInsights />
  • 🏠 Home
  • 📊 SQL
  • 🐍 Python
  • 📈 Power BI
  • 📗 Excel
  • 💼 Career
  • 🎯 Interview Q&A
  • 📁 Case Study
  • 📥 Downloads
  • 🚀 My Portfolio
<DataInsights />

Practical Data Analytics tutorials covering SQL, Python, Power BI, Excel and career guidance for aspiring analysts — 100% free.

Topics

  • SQL Tutorials
  • Python Guide
  • Power BI
  • Excel Tips
  • Career Guide

Quick Links

  • 🛠️ All Tools
  • 🗓️ Archive
  • 📬 Contact
  • 🔍 Search
  • Portfolio
  • Kaggle
  • GitHub

Legal & Info

  • About
  • Contact
  • Privacy Policy
  • Disclaimer
  • Terms & Conditions
  • DMCA
  • Sitemap
Copyright © 2026 Data Insights by Jatin Kumar. All Rights Reserved.Built with ❤️ for Data Analysts
Home/Power BI/Data Modeling — The Foundation of Power BI...

Data Modeling — The Foundation of Power BI

A
August 3, 2026 Jatin Kumar 38 min read Power BI
Data Insights Power BI Masterclass — Part 2

Data Modeling — The Foundation of Power BI

Power BI mein dashboards banana easy hai, lekin sahi results tabhi aayenge jab Data Model correctly designed hoga. Tables, Relationships, Star Schema, Keys, Cardinality aur Date Table — yeh sab samjho toh DAX apne aap powerful ban jaayega. Data Insights par complete theory.

📑 Is Part Mein Aap Kya Sikhenge:

Data Modeling Power BI ka backbone hai — bina iske DAX, visuals aur reports sab galat results denge. Yeh part pure theory heavy hai:

  • Tables & Relationships: Fact table, Dimension table — kya hain aur kyun zaroori hain
  • Star Schema vs Snowflake: Kaunsa design kab use karein — deep comparison
  • Keys: Primary Key, Foreign Key, Composite Key — theory + examples
  • Cardinality: One-to-One, One-to-Many, Many-to-Many — complete theory
  • Cross Filter Direction: Single vs Both — kab kya use karein
  • Date Table: Kyun mandatory hai, kaise banayein — Time Intelligence ki neev

📋 Data Model Context: Is part mein hum apne Sales dataset ko properly model karenge. Ek single flat table ki jagah hum isko multiple related tables mein split karenge — jaise real-world enterprise databases mein hota hai. Yeh approach data redundancy kam karta hai, performance improve karta hai, aur DAX calculations accurate banata hai.

Table Name Type Columns Role
Sales (Fact) Fact Table OrderID, OrderDate, CustomerID, ProductID, SalespersonID, Qty, Amount Transactions / Events
Products (Dim) Dimension Table ProductID, ProductName, Category, Price Product details lookup
Customers (Dim) Dimension Table CustomerID, CustomerName, City, Region Customer details lookup
Salesperson (Dim) Dimension Table SalespersonID, SalespersonName, Territory Sales team lookup
Calendar (Dim) Date Table Date, Year, Quarter, Month, MonthName, WeekDay Time Intelligence foundation

1. Tables & Relationships — Theory

🔍 Definition: In Power BI's data model, tables are categorized into two types — Fact Tables and Dimension Tables. A Fact Table stores transactional, measurable, quantitative data (events that happened — sales, orders, clicks, logins). A Dimension Table stores descriptive, categorical, contextual data (details about entities — product names, customer info, locations, dates). Relationships are the logical connections between these tables — they tell Power BI how data in one table relates to data in another, enabling cross-table calculations and filtering.

🎯 Samjho Hinglish Mein: Socho ek hospital ka system hai. Fact Table woh register hai jisme likha hai — "Patient X ne Date Y ko Doctor Z se Treatment A liya aur Bill B tha." Yeh transaction hai — kab, kya, kitna. Ab Patient ka naam, address, blood group — yeh Patient Dimension Table mein hoga. Doctor ka specialization, experience — yeh Doctor Dimension Table mein hoga. Treatment ki details — Treatment Dimension mein. Sab separate tables hain lekin PatientID, DoctorID se connected hain. Power BI mein bhi yehi hota hai — Fact table mein IDs hote hain jo Dimension tables se connect hote hain relationships ke through.

💡 Fact vs Dimension — Quick Identification:
• Fact Table Clues: Contains numbers you want to SUM/COUNT/AVERAGE (Amount, Qty, Revenue). Has foreign key columns (ProductID, CustomerID). Usually the LARGEST table. Rows grow over time (new transactions daily).
• Dimension Table Clues: Contains text/descriptive columns (Name, Category, City). Has a primary key column (unique ID). Usually SMALLER tables. Rows are relatively static (products don't change daily).
• Simple Rule: "What happened?" = Fact Table. "Who/What/Where/When?" = Dimension Table.
• In our Sales model: Sales table = Fact (transactions). Products, Customers, Salesperson, Calendar = Dimensions (descriptions).

📊 Fact Table vs Dimension Table — Comparison:

Feature Fact Table Dimension Table
Contains Measurable data (numbers, metrics) Descriptive data (text, categories)
Examples Sales, Orders, Transactions, Clicks Products, Customers, Dates, Locations
Key Type Foreign Keys (references to dimensions) Primary Key (unique identifier)
Row Count Very Large (millions+) Relatively Small (hundreds to thousands)
Growth Grows rapidly (daily new transactions) Relatively stable (new products are rare)
DAX Aggregation SUM, COUNT, AVERAGE applied here Used for filtering & slicing
Granularity One row per transaction/event One row per entity (one row per product)

📊 Relationship Visual — How Tables Connect:

┌──────────────────┐ │ Calendar (Dim) │ │ Date (PK) │ │ Year,
Month... │ └────────┬─────────┘ │ 1:N │ ┌──────────────┐ ┌────────▼─────────┐ ┌──────────────────┐ │ Products(Dim)│ │ Sales (Fact) │ │ Customers (Dim) │ │ ProductID(PK)│───▶│ OrderID │◀───│ CustomerID (PK) │ │ ProductName │ 1:N│ OrderDate (FK) │ 1:N│ CustomerName │ │ Category │ │ CustomerID (FK) │ │ City,
Region │ │ Price │ │ ProductID (FK) │ └──────────────────┘ └──────────────┘ │ SalespersonID(FK)│ │ Qty,
Amount │ └────────▲─────────┘ │ 1:N ┌────────┴─────────┐ │ Salesperson (Dim)│ │ SalespersonID(PK)│ │ Name,
Territory │ └──────────────────┘
Arrow Direction: Dimension (1) ──▶ Fact (N)
Filter flows
FROM Dimension TO Fact (by default)
⚡ Important — Relationships in Power BI:
• Power BI mein relationships Model View mein set hoti hain — tables ke beech lines kheech ke ya Manage Relationships dialog se.
• Power BI auto-detect bhi karta hai relationships (based on matching column names), lekin yeh hamesha sahi nahi hota — manually verify karo!
• Relationship ka direction matters — filters Dimension se Fact ki taraf flow karte hain (by default). Isko samajhna DAX ke liye critical hai.
• Ek model mein multiple relationships ho sakti hain do tables ke beech, lekin sirf ek ACTIVE hoti hai at a time. Baaki inactive rehti hain (USERELATIONSHIP DAX function se activate kar sakte ho).

⚠️ Common Mistakes:

  • Mistake: Sab data ek hi flat table mein rakhna (single table model). Fix: Data ko Fact aur Dimension tables mein split karo. Flat table mein data redundancy hoti hai, model slow hota hai, aur DAX complex ho jaata hai.
  • Mistake: Auto-detected relationships ko verify nahi karna. Fix: Model View mein jaake har relationship check karo — correct columns connected hain? Cardinality sahi hai? Direction sahi hai?
  • Mistake: Fact table mein descriptive columns rakhna (jaise ProductName, CustomerCity). Fix: Sirf IDs (Foreign Keys) rakho Fact table mein. Descriptions Dimension tables mein honi chahiye. RELATED function se laao jab zaroorat ho.
  • Mistake: Relationships banaye bina DAX likhna. Fix: Pehle Model View mein relationships correctly set karo, phir DAX likho. Bina relationships ke CALCULATE, FILTER, RELATED sab fail honge.

💬 Interview Questions:

Q1: Fact Table aur Dimension Table mein kya difference hai?
Ans: Fact Table measurable, transactional data store karti hai — jaise Sales Amount, Quantity, Revenue. Iske rows time ke saath grow hote hain (daily new transactions). Dimension Table descriptive, contextual data store karti hai — jaise Product Name, Customer City, Date details. Yeh relatively static hoti hai. Fact Table mein Foreign Keys hoti hain jo Dimension Tables ke Primary Keys se connect hoti hain. DAX mein aggregations (SUM, COUNT) Fact Table par hoti hain, aur filtering/slicing Dimension Tables se hoti hai.

Q2: Kya Power BI mein bina relationships ke kaam chal sakta hai?
Ans: Technically haan — agar sab data ek hi flat table mein hai toh relationships ki zaroorat nahi. Lekin yeh approach bahut galat hai kyunki: (1) Data redundancy hogi — ProductName har row mein repeat hoga. (2) Model size badega — slow performance. (3) DAX complex ho jaayega. (4) Data inconsistency ka risk — ek jagah "Laptop" likha, doosri jagah "laptop". Professional approach hamesha normalized model (Fact + Dimensions + Relationships) hai.

Q3: Power BI mein relationships kahan set karte hain?
Ans: Relationships Model View mein set hote hain. Three ways: (1) Drag-and-drop — ek table ke column ko doosri table ke column par drag karo. (2) Manage Relationships dialog — Home/Modeling tab → Manage Relationships → New. (3) Auto-detect — Power BI tries to detect automatically based on column names. Best practice: Auto-detect ko verify karo aur manually confirm karo ki correct columns connected hain aur cardinality sahi set hai.

Q4: Ek model mein do tables ke beech multiple relationships ho sakti hain?
Ans: Haan — lekin sirf ek ACTIVE relationship hoti hai at a time (solid line dikhti hai). Baaki relationships INACTIVE rehti hain (dotted line dikhti hai). Example: Sales table mein OrderDate aur ShipDate dono hain aur dono Calendar table se connect honi chahiye — ek active (OrderDate), ek inactive (ShipDate). Inactive relationship ko DAX mein USERELATIONSHIP(Sales[ShipDate], Calendar[Date]) se temporarily activate kar sakte ho specific measures mein.

2. Star Schema vs Snowflake Schema — When to Use

🔍 Definition: Star Schema and Snowflake Schema are two fundamental data modeling design patterns used in data warehousing and BI tools. In a Star Schema, the Fact Table sits at the center and is directly connected to all Dimension Tables — forming a star shape. Dimension tables are denormalized (flat — all attributes in one table). In a Snowflake Schema, Dimension Tables are further normalized — broken into sub-dimension tables, creating a snowflake-like branching structure. Power BI strongly recommends and is optimized for Star Schema.

🎯 Samjho Hinglish Mein: Star Schema ek wheel jaisa hai — center mein Fact table (hub) aur usse directly connected Dimension tables (spokes). Simple, flat, fast. Snowflake Schema ek tree jaisa hai — Dimension tables ke aage aur sub-tables hain. Jaise Products → Category → Sub-Category → Department — har level alag table mein. Yeh normalized hai, data redundancy kam hai, lekin Power BI ke liye complex aur slow hai. Power BI ka VertiPaq engine Star Schema ke liye optimized hai — isliye hamesha Star Schema prefer karo Power BI mein.

💡 Power BI ka Official Recommendation:
• Microsoft officially Star Schema recommend karta hai Power BI ke liye.
• VertiPaq engine columnar compression use karta hai — denormalized (flat) dimension tables ko efficiently compress karta hai.
• Snowflake Schema mein extra joins lagte hain — queries slow hoti hain.
• Agar source database Snowflake Schema mein hai, toh Power Query mein Merge Queries karke Dimensions ko flatten (denormalize) karo before loading into model.
• Rule: "Flatten your snowflakes into stars before loading into Power BI."

📊 Star Schema Visual:

 STAR SCHEMA (Recommended for Power BI) ═══════════════════════════════════════
text

    ┌──────────────┐          ┌──────────────────┐
    │  Products    │          │   Customers      │
    │ ProductID    │          │  CustomerID      │
    │ ProductName  │          │  CustomerName    │
    │ Category     │◄─────┐  │  City            │
    │ SubCategory  │      │  │  Region          │
    │ Price        │      │  │  Segment         │
    └──────────────┘      │  └────────┬─────────┘
                          │           │
                 ┌────────▼───────────▼────────┐
                 │        Sales (Fact)          │
                 │  OrderID, OrderDate          │
                 │  CustomerID, ProductID       │
                 │  SalespersonID               │
                 │  Qty, Amount                 │
                 └────────▲───────────▲────────┘
                          │           │
    ┌──────────────┐      │  ┌────────┴─────────┐
    │  Calendar    │      │  │  Salesperson     │
    │  Date        │──────┘  │  SalespersonID   │
    │  Year        │         │  Name            │
    │  Quarter     │         │  Territory       │
    │  Month       │         └──────────────────┘
    └──────────────┘

    ✅ All dimensions DIRECTLY connected to Fact
    ✅ No sub-tables — flat dimensions
    ✅ Simple, fast, Power BI optimized

📊 Snowflake Schema Visual:

 SNOWFLAKE SCHEMA (NOT recommended for Power BI) ═══════════════════════════════════════════════
┌────────────┐ ┌──────────────┐
│ Department │───▶│ Category │───▶┌──────────────┐
│ DeptID │ │ CategoryID │ │ Products │
│ DeptName │ │ CatName │ │ ProductID │──┐
└────────────┘ │ DeptID (FK) │ │ ProductName │ │
└──────────────┘ │ CategoryID │ │
└──────────────┘ │
┌────────────┐ ┌──────────────┐ │
│ Region │───▶│ City │───▶┌────────────────▼──┐
│ RegionID │ │ CityID │ │ Sales (Fact) │
│ RegionName│ │ CityName │ │ OrderID │
└────────────┘ │ RegionID(FK)│ │ ProductID (FK) │
└──────────────┘ │ CustomerID (FK) │
└───────────────────┘

❌ Dimensions broken into sub-tables
❌ More joins needed = slower queries
❌ Complex model — harder to understand
❌ Power BI VertiPaq not optimized for this

📊 Star vs Snowflake — Comparison:

Feature Star Schema ⭐ Snowflake Schema ❄️
Structure Fact + flat Dimensions (one level) Fact + normalized Dimensions (multiple levels)
Joins Required Fewer (Fact → Dimension directly) More (Fact → Dim → Sub-Dim → Sub-Sub)
Query Performance Faster (fewer joins) Slower (more joins)
Data Redundancy Some redundancy in dimensions Minimal redundancy
Complexity Simple — easy to understand Complex — hard to navigate
Storage Space Slightly more Less (normalized)
Power BI Fit ✅ Perfect — VertiPaq optimized ❌ Not recommended
Best For BI tools (Power BI, SSAS, Tableau) Traditional data warehouses (storage optimization)
⚡ Important — What If Source is Snowflake? Agar tumhara source database (SQL Server, Oracle) Snowflake Schema mein designed hai — koi problem nahi. Power Query mein Merge Queries use karke sub-dimension tables ko main dimension mein merge (flatten) karo. Example: Products table mein CategoryID hai aur Category details alag table mein — Merge karke Category columns Products mein laao. Load ke baad model Star Schema ban jaayega.

⚠️ Common Mistakes:

  • Mistake: Source database ka Snowflake Schema directly Power BI mein load karna. Fix: Power Query mein pehle flatten karo — Merge Queries se sub-tables ko main dimension mein combine karo.
  • Mistake: Star Schema mein redundancy dekhke ghabrana. Fix: VertiPaq engine columnar compression karta hai — redundant text values (repeated "Electronics" in Category) bahut efficiently compress hote hain. Storage ka farak negligible hai.
  • Mistake: Dimension tables ke beech direct relationships banana (Dim-to-Dim). Fix: Star Schema mein Dimensions sirf Fact table se connect honi chahiye. Dim-to-Dim relationships model ko complex aur unpredictable banati hain.

💬 Interview Questions:

Q1: Star Schema aur Snowflake Schema mein kya difference hai?
Ans: Star Schema mein Fact Table center mein hoti hai aur saari Dimension Tables directly ussey connected hoti hain — Dimensions flat/denormalized hoti hain (sab attributes ek table mein). Snowflake Schema mein Dimension Tables further normalized hoti hain — sub-dimension tables mein split hoti hain (Category → Sub-Category → Department). Star Schema simple, fast aur Power BI ke liye recommended hai. Snowflake Schema storage-efficient hai lekin queries slow hoti hain extra joins ki wajah se.

Q2: Power BI mein Star Schema kyun recommended hai?
Ans: Power BI ka VertiPaq engine columnar storage aur compression use karta hai — yeh denormalized (flat) dimension tables ko bahut efficiently handle karta hai. Star Schema mein fewer joins hote hain — queries fast hoti hain. DAX calculations simpler hoti hain kyunki sab dimensions directly Fact se connected hain. Model visually simple hota hai — easy to understand aur maintain. Microsoft officially bhi Star Schema recommend karta hai Power BI ke liye.

Q3: Agar source Snowflake Schema mein hai toh Power BI mein kya karenge?
Ans: Power Query Editor mein Merge Queries use karke sub-dimension tables ko main dimension tables mein flatten (denormalize) karenge. Example: Agar Products table mein CategoryID hai aur Category details alag Category table mein hain — toh Power Query mein Products aur Category ko merge karke ek flat Products dimension banaenge. Phir model load hone par Star Schema structure hogi. Principle: "Transform in Power Query, model in Star Schema."

3. Primary Key, Foreign Key, Composite Key

🔍 Definition: Keys are the backbone of data relationships. A Primary Key (PK) is a column (or set of columns) in a table that uniquely identifies each row — no duplicates, no nulls allowed. A Foreign Key (FK) is a column in one table that references the Primary Key of another table — it creates the link/relationship between tables. A Composite Key is a Primary Key made up of two or more columns combined — individually they may have duplicates, but their combination is unique. Understanding keys is essential because Power BI relationships are built on key columns.

🎯 Samjho Hinglish Mein: Primary Key tumhara Aadhaar Number hai — unique, sirf tumhara, koi duplicate nahi. Foreign Key tumhari bank account mein Aadhaar Number ka reference hai — bank ne tumhara Aadhaar link kiya taaki woh tumhe identify kar sake Aadhaar database se. Composite Key socho school register mein — sirf Roll Number unique nahi hai (kyunki har class mein Roll 1 hai), lekin Roll Number + Class milke unique hai. "Roll 1, Class 10A" unique hai poore school mein. Power BI mein Dimension table ka PK aur Fact table ka FK milke relationship banate hain.

💡 Power BI Mein Keys Ka Role:
• Dimension Table Side: Hamesha Primary Key honi chahiye — har row unique. Yeh relationship ka "One" side hai.
• Fact Table Side: Foreign Key hoti hai — yeh values repeat ho sakti hain (kyunki ek product multiple baar sell hota hai). Yeh relationship ka "Many" side hai.
• Relationship: Dimension PK ←→ Fact FK. Power BI isi link ke through filter propagation karta hai.
• Composite Key in Power BI: Power BI directly composite keys support nahi karta relationships mein. Workaround: Power Query mein ek new column banao jo dono columns combine kare (e.g., [Column1] & "-" & [Column2]), phir us combined column ko key ke roop mein use karo.

📊 Keys — Visual Examples:

PRIMARY KEY Example — Products Table: ───────────────────────────────────────── ProductID (PK) │ ProductName │ Category ───────────────────────────────────────── P001 │ Laptop │ Electronics ← Unique P002 │ Mouse │ Accessories ← Unique P003 │ Desk Chair │ Furniture ← Unique P001 │ Keyboard │ Accessories ← ❌ VIOLATION! P001 already exists! ───────────────────────────────────────── Rule: ProductID mein koi value repeat nahi honi chahiye.
FOREIGN KEY Example — Sales (Fact) Table:
─────────────────────────────────────────
OrderID │ ProductID (FK) │ Qty │ Amount
─────────────────────────────────────────
1001 │ P001 │ 2 │ 110000 ← P001 repeat OK!
1002 │ P002 │ 10 │ 5000
1003 │ P003 │ 3 │ 24000
1004 │ P001 │ 1 │ 55000 ← P001 again — valid!
─────────────────────────────────────────
Rule: FK mein
values repeat ho sakti hain
(ek product multiple baar sell hota hai).
But har FK value MUST exist in Dimension PK!

COMPOSITE KEY Example — School Attendance:
─────────────────────────────────────────
RollNo │ ClassID │ RollNo+ClassID (PK) │ StudentName
─────────────────────────────────────────
1 │ 10A │ 1-10A │ Amit
1 │ 10B │ 1-10B │ Priya
2 │ 10A │ 2-10A │ Rahul
1 │ 10A │ 1-10A │ ❌ DUPLICATE!
─────────────────────────────────────────
Rule: RollNo alone is not unique, ClassID alone is not unique,

but their COMBINATION must be unique.

📊 Keys — Complete Comparison:

Feature Primary Key Foreign Key Composite Key
Purpose Uniquely identify each row Reference another table's PK Unique ID using multiple columns
Duplicates? ❌ Not allowed ✅ Allowed (repeats OK) ❌ Combination must be unique
Nulls? ❌ Not allowed ✅ Nulls possible (orphan records) ❌ Not allowed in any component
Found In Dimension Tables (One side) Fact Tables (Many side) Either (when no single unique column)
Count per Table One per table Multiple possible One per table (multi-column)

💻 Power Query — Composite Key Banana:

// Power BI mein composite key directly support nahi hota // Workaround: Power Query mein custom column banao // // Step 1: Power Query Editor mein table open karo // Step 2: Add Column tab → Custom Column // Step 3: Formula likhlo: // // M Language formula: = Text.
From([RollNo]) & "-" & [ClassID] // // This creates: "1-10A",
"1-10B", "2-10A" — unique combined keys! // Now use this new column as the relationship key. // // IMPORTANT: Same composite column DONO tables mein banana padega // (both sides — fact aur dimension mein same formula apply karo)
⚡ Important — Duplicate PK Issue: Agar Dimension Table mein Primary Key column mein duplicates hain, toh Power BI relationship create karte waqt warning dega ya incorrect results aayenge. Pehle Power Query mein verify karo: Column select karo → Right-click → Remove Duplicates (ya pehle check karo ki duplicates kyun hain — kya data issue hai ya wrong column choose kiya).

⚠️ Common Mistakes:

  • Mistake: Dimension table mein PK column mein duplicates rehna. Fix: Power Query mein verify karo — duplicate rows hatao ya data source fix karo. PK mein duplicate = broken relationship.
  • Mistake: Fact table mein aisi FK value hona jo Dimension PK mein exist nahi karti (orphan records). Fix: Power Query mein anti-join check karo ya Dimension mein "Unknown" catch-all row add karo.
  • Mistake: Composite Key ka case mismatch — ek table mein "1-10a" aur doosri mein "1-10A". Fix: Composite key banate waqt Text.Upper() ya Text.Lower() apply karo dono tables mein.
  • Mistake: ID columns ko Number type rakhna ek table mein aur Text doosri mein. Fix: Dono tables mein relationship columns ka data type SAME hona chahiye. Mismatch se relationship nahi banegi.

💬 Interview Questions:

Q1: Primary Key aur Foreign Key mein kya difference hai?
Ans: Primary Key (PK) ek column hai jo table ki har row ko uniquely identify karta hai — duplicates aur nulls allowed nahi hain. Yeh Dimension table mein hoti hai aur relationship ka "One" side represent karti hai. Foreign Key (FK) ek column hai jo doosri table ke PK ko reference karta hai — duplicates allowed hain (kyunki ek product multiple baar sell ho sakta hai). Yeh Fact table mein hoti hai aur relationship ka "Many" side represent karti hai. PK aur FK milke relationship create karte hain.

Q2: Power BI mein Composite Key kaise handle karte hain?
Ans: Power BI directly composite keys support nahi karta relationships mein — sirf single column pe relationship ban sakti hai. Workaround: Power Query mein ek custom column banao jo multiple columns ko concatenate kare. Example: Text.From([RollNo]) & "-" & [ClassID] — yeh combined unique key banata hai. Yeh same custom column dono tables (Fact aur Dimension) mein banana padega identical formula se. Phir us combined column par relationship create karo.

Q3: Agar Dimension table mein Primary Key duplicate hai toh kya hoga?
Ans: Power BI Many-to-Many relationship create karega (ya error dega agar expected cardinality One-to-Many thi). Duplicate PK se DAX calculations galat results denge — SUM doubled ho sakta hai, RELATED function ambiguous values return karega. Fix: Pehle data source mein check karo ki duplicates kyun hain (data quality issue?). Power Query mein Remove Duplicates karo ya Group By karke aggregate karo. PK hamesha unique honi chahiye.

4. Cardinality (1:1, 1:N, M:N) — Deep Theory

🔍 Definition: Cardinality defines the nature of the relationship between two tables — specifically, how many rows in Table A can match how many rows in Table B. There are three types: One-to-One (1:1) where each row in Table A matches exactly one row in Table B. One-to-Many (1:N) where one row in Table A can match multiple rows in Table B — this is the most common and recommended type. Many-to-Many (M:N) where multiple rows in both tables can match each other — this is complex and should be avoided when possible. Power BI automatically detects cardinality when you create a relationship, but understanding it deeply is critical for correct DAX behavior.

🎯 Samjho Hinglish Mein: One-to-One: Ek person ka ek Aadhaar card — 1 person = 1 Aadhaar, koi sharing nahi. One-to-Many: Ek teacher multiple classes padhata hai — 1 teacher = many classes, lekin ek class ka ek hi teacher. Many-to-Many: Students aur Courses — ek student multiple courses le sakta hai, aur ek course mein multiple students hain. Power BI mein 90% relationships One-to-Many hoti hain — Dimension (One side) → Fact (Many side). Yeh sabse clean aur predictable type hai.

💡 Power BI Mein Cardinality Ka Impact:
• 1:N (One-to-Many): Sabse common aur recommended. Dimension table One side (unique PK), Fact table Many side (repeating FK). Filter Dimension se Fact ki taraf flow karta hai. DAX perfectly kaam karta hai.
• 1:1 (One-to-One): Rare — dono tables mein relationship column unique hona chahiye. Usually tab aata hai jab ek table ko 2 parts mein split kiya ho. Performance par koi special impact nahi.
• M:N (Many-to-Many): Complex aur risky. Dono sides mein duplicates hain. Power BI handle kar sakta hai lekin DAX ambiguous ho sakta hai, calculations doubled ya incorrect ho sakte hain. Avoid jab possible ho — bridge table use karo.
• Interview Gold: "Best practice kya hai?" → "Hamesha One-to-Many relationships design karo Star Schema mein. Many-to-Many se bachne ke liye bridge/junction table create karo."

📊 Cardinality Types — Visual Examples:

 ONE-TO-ONE (1:1) — Rare ═══════════════════════ Employee Table Employee Details Table ┌──────────┐ ┌──────────────────┐ │ EmpID(PK)│ │ EmpID (PK) │ │ 101 │───────────▶│ 101 │ │ 102 │───────────▶│ 102 │ │ 103 │───────────▶│ 103 │ └──────────┘ └──────────────────┘ Each employee has exactly ONE detail record.
ONE-TO-MANY (1:N) — Most Common ✅
════════════════════════════════════
Products (Dim) Sales (Fact)
┌──────────┐ ┌──────────┐
│ ProdID │ │ ProdID │
│ P001 │──────┬────▶│ P001 │ Order 1001
│ │ ├────▶│ P001 │ Order 1004
│ │ └────▶│ P001 │ Order 1007
│ P002 │──────┬────▶│ P002 │ Order 1002
│ │ └────▶│ P002 │ Order 1005
│ P003 │───────────▶│ P003 │ Order 1003
└──────────┘ └──────────┘
One product appears in MANY sales transactions.

MANY-TO-MANY (M:N) — Avoid if possible ⚠️
═══════════════════════════════════════════
Students Courses
┌──────────┐ ┌──────────┐
│ Amit │──────┬────▶│ Math │◀──────┐
│ │ └────▶│ Science │◀──┐ │
│ Priya │──────┬────▶│ Math │ │ │
│ │ └────▶│ English │◀──┤ │
│ Rahul │───────────▶│ Science │ │ │
└──────────┘ └──────────┘ │ │
│ │
Multiple students in multiple courses — MESSY!

SOLUTION: Bridge/Junction Table
Students ──1:N──▶ Enrollment ◀──N:1── Courses
(StudentID, CourseID)

📊 Cardinality Comparison:

Feature 1:1 1:N (Recommended) M:N
Both Sides Unique? Yes — both unique One unique, one repeating Both can repeat
How Common? Rare (~5%) Most Common (~90%) Uncommon (~5%)
DAX Behavior Clean — no issues Clean — standard behavior Complex — duplicated values risk
Example Employee ↔ Employee Details Products → Sales Students ↔ Courses
Fix if M:N? N/A N/A Create Bridge/Junction table
⚡ Important — Many-to-Many Handling: Agar M:N relationship avoid nahi ho sakti (real business scenario hai), toh Power BI mein handle kar sakte ho — lekin carefully. Steps: (1) Ek Bridge Table (junction/linking table) banao jisme dono tables ke keys hon. (2) Do separate 1:N relationships banao (Table A → Bridge, Table B → Bridge). (3) Cross filter direction "Both" set karo bridge table par. (4) DAX mein CROSSFILTER ya TREATAS use karo complex scenarios mein.

⚠️ Common Mistakes:

  • Mistake: Power BI auto-detect ne M:N cardinality set ki aur ignore kar diya. Fix: M:N ka matlab hai kisi table mein PK duplicate hai — investigate karo. Kya data quality issue hai? Kya wrong column par relationship hai?
  • Mistake: M:N relationship mein SUM measure doubled values show karna. Fix: Bridge table create karo ya DISTINCTCOUNT/SUMX carefully use karo. Direct SUM M:N mein unreliable hai.
  • Mistake: 1:1 relationship dekhke tables merge nahi karna. Fix: Agar dono tables 1:1 hain — often better hai Power Query mein merge karke ek table banana. Extra relationship ka overhead kam ho jaata hai.

💬 Interview Questions:

Q1: Power BI mein kaun si cardinality sabse common aur recommended hai?
Ans: One-to-Many (1:N) sabse common aur recommended hai. Star Schema mein Dimension table One side hoti hai (unique PK — each product appears once) aur Fact table Many side hoti hai (FK — each product appears in multiple sales transactions). Yeh cardinality predictable filter behavior deti hai aur DAX calculations accurate hote hain. 90% relationships 1:N type ki honi chahiye ek well-designed model mein.

Q2: Many-to-Many relationship se kaise bachein?
Ans: Bridge/Junction table create karo. Example: Students (M) ↔ Courses (N) — ek Enrollment table banao jisme StudentID aur CourseID dono hon, aur har combination unique ho. Phir Students → Enrollment (1:N) aur Courses → Enrollment (1:N) — do clean 1:N relationships ban gayin. Power BI mein yeh bridge table Power Query mein bana sakte ho ya source database se laa sakte ho. M:N avoid karna best practice hai kyunki DAX ambiguity aur duplicated calculations ka risk hota hai.

Q3: Cardinality galat set hone se kya impact hota hai DAX par?
Ans: Bahut bada impact hota hai. (1) Agar relationship 1:N honi chahiye thi lekin M:N set hai — SUM measure values duplicate karke double dikha sakta hai. (2) RELATED function sirf 1:N mein kaam karta hai (Many side se One side ka value laata hai) — M:N mein error ya unexpected results aayenge. (3) Filter propagation unpredictable ho jaati hai — slicer selections galat data filter karenge. Hamesha Model View mein cardinality verify karo aur ensure karo ki Dimension side mein PK truly unique hai.

5. Cross Filter Direction (Single vs Both)

🔍 Definition: Cross Filter Direction determines the direction in which filters flow between two related tables. In Single direction (default for 1:N), filters flow from the Dimension table (One side) to the Fact table (Many side) only — this is the natural and recommended direction. In Both directions (bidirectional), filters flow in both directions — from Dimension to Fact AND from Fact back to Dimension. Bidirectional filtering is powerful but can cause ambiguity, circular dependency, and performance issues if overused. Understanding this concept is crucial because it directly affects what data users see in visuals when slicers and filters are applied.

🎯 Samjho Hinglish Mein: Socho ek company hai. Manager (Dimension) apni team (Fact) ko instructions deta hai — yeh Single direction hai (top-down). Manager bole "Sales team, North region ka data dikhao" — filter Manager se Team ki taraf gaya, filtered data dikha. Ab Both direction ka matlab hai — Team bhi Manager ko filter kar sakti hai: "Sirf woh managers dikhao jinki team ne actually sales ki." Yeh useful hai lekin risky — agar bahut saari tables mein Both laga diya toh filters circular ho jayenge (A filters B, B filters C, C filters A — infinite loop risk!) aur Power BI confused ho jaayega.

💡 When Each Direction is Used:
• Single (Default — 95% cases): Dimension → Fact. User selects "Electronics" in Category slicer → Sales table filtered to show only Electronics orders. Products table filters Sales table. Natural aur safe.
• Both (Special cases — 5%): Dimension ↔ Fact. Needed when you want Fact table data to filter back Dimension table. Example: "Show only those Products that had at least one sale" — iske liye Sales se Products ki taraf filter jaana chahiye (reverse direction). Bidirectional enables this.
• Best Practice: Default Single rakho. Sirf specific use cases ke liye Both use karo. Agar Both chahiye ek measure mein, toh relationship change karne ki jagah DAX mein CROSSFILTER function use karo — yeh sirf us specific measure mein direction change karta hai, globally nahi.

📊 Filter Flow — Visual Explanation:

 SINGLE DIRECTION (Default — Recommended) ═════════════════════════════════════════
Products (Dim) Sales (Fact)
┌──────────────┐ ┌──────────────┐
│ Category: │ │ │
│ Electronics │═══════▶│ Shows only │
│ (selected) │ FILTER│ Electronics │
│ │ FLOWS │ sales rows │
└──────────────┘ ════▶ └──────────────┘

✅ Dimension filters Fact — NATURAL
❌ Fact CANNOT filter Dimension

BOTH DIRECTIONS (Bidirectional)
═══════════════════════════════

Products (Dim) Sales (Fact)
┌──────────────┐ ┌──────────────┐
│ Shows only │ │ │
│ products │◀═══════│ North region │
│ sold in │ FILTER │ selected │
│ North │ FLOWS │ │
│ │ ◀════ │ │
└──────────────┘ └──────────────┘
║ ▲
║ ALSO filters ║
▼ downward ║
┌──────────────┐ ║
│ Slicer shows│ ║
│ only North │ ║
│ products │ ║
└──────────────┘

✅ Both directions filter each other
⚠️ Can cause ambiguity & circular paths

📊 Single vs Both — Comparison:

Feature Single Direction Both Directions
Filter Flow Dimension → Fact only Dimension ↔ Fact (both ways)
Default? Yes (for 1:N relationships) No — must be manually set
Performance Better — simpler query plan Can be slower — more complex
Ambiguity Risk No risk Circular dependency possible
Use Case Standard filtering (95% cases) Dynamic slicers, M:N bridge tables

💻 DAX Alternative — CROSSFILTER Function:

// Instead of setting Both direction permanently
on the relationship, // use CROSSFILTER in DAX for specific measures only:
Products With Sales =
CALCULATE(
DISTINCTCOUNT(Products[ProductID]),
CROSSFILTER(Products[ProductID], Sales[ProductID], Both)
)

// This temporarily enables bidirectional filtering
// ONLY for this specific measure — does not affect other measures!
// Much safer than changing relationship direction globally.
//
// CROSSFILTER options: None, OneWay, Both
📋 Pro Tip: Jab bhi koi situation aaye jisme Both direction chahiye — pehle socho ki kya DAX mein CROSSFILTER ya TREATAS se solve ho sakta hai. Agar haan, toh relationship Single hi rakho aur DAX mein handle karo. Global Both direction set karna last resort hona chahiye. Reason: Global Both baaki saare measures ko bhi affect karta hai — unintended side effects ho sakte hain.
⚡ Important — Circular Dependency: Agar tumhare model mein 3 tables hain — A, B, C — aur teeno ke beech Both direction hai: A ↔ B ↔ C ↔ A. Toh filter circular ho jayega — Power BI confused ho jaayega aur ambiguity error dega. Yeh "circular dependency" kehlata hai. Fix: Model mein sirf zaroori relationships par Both lagao. Baaki Single rakho. Power BI sometimes automatically Both disable kar deta hai circular path detect karne par.

⚠️ Common Mistakes:

  • Mistake: Saari relationships par Both direction set karna "just in case." Fix: Sirf specific use cases ke liye Both use karo. Default Single rakho — safer aur faster hai.
  • Mistake: Slicer mein saare products dikhna chahiye lekin sirf sold products dikh rahe hain. Fix: Yeh Both direction ka effect hai — Fact table Products table ko filter kar raha hai. Agar saare products dikhane hain toh Single direction rakho ya slicer ko "Show items with no data" enable karo.
  • Mistake: Circular dependency error aana. Fix: Model View mein check karo kahan Both direction lagayi hai. Unnecessary Both hatao. DAX CROSSFILTER use karo instead.

💬 Interview Questions:

Q1: Single aur Both cross filter direction mein kya difference hai?
Ans: Single direction (default) mein filter sirf Dimension table se Fact table ki taraf flow hota hai (One → Many). User Products table mein "Electronics" select kare toh Sales filtered dikhegi, lekin Sales ka data Products table ko filter nahi karega. Both direction mein filter dono taraf flow hota hai — Dimension → Fact aur Fact → Dimension. Example: "Sirf woh products dikhao jinki sales hui" — iske liye Fact se Dimension ki taraf filter chahiye, toh Both lagega.

Q2: CROSSFILTER DAX function kab use karte hain?
Ans: Jab hume sirf ek specific measure ke liye cross filter direction temporarily change karni ho — bina globally relationship modify kiye. CROSSFILTER CALCULATE ke andar use hota hai aur options hain: None (filter off), OneWay (single), Both (bidirectional). Example: Products With Sales measure mein Both chahiye lekin Total Revenue measure mein nahi — toh Products With Sales mein CROSSFILTER use karo. Yeh approach safe hai kyunki baaki measures unaffected rehte hain.

Q3: Bidirectional filtering se kya risks hain?
Ans: (1) Circular dependency — multiple tables ke beech Both direction se filter ka infinite loop ban sakta hai, Power BI error dega. (2) Performance degradation — both direction mein engine ko zyada paths evaluate karne padte hain, queries slow hoti hain. (3) Unexpected results — users ko samajh nahi aata ki slicer values kyun dynamically change ho rahe hain (kyunki reverse filtering ho raha hai). (4) Ambiguity — DAX ke liye unclear ho sakta hai ki filter kahan se aa raha hai. Best practice: Default Single rakho, Both sirf zaroori jagah, prefer CROSSFILTER DAX function.

6. Date Table — Why It's Critical

🔍 Definition: A Date Table (Calendar Table) is a dedicated Dimension Table that contains one row for every single date in your data range — with additional calculated columns like Year, Quarter, Month Number, Month Name, Day, Weekday, Financial Year, etc. It is a mandatory requirement for using Power BI's Time Intelligence DAX functions (TOTALYTD, SAMEPERIODLASTYEAR, DATEADD, DATESYTD, etc.). The Date Table must be continuous (no gaps — every date from start to end must exist, even if no transaction happened on that date), and it must be marked as a Date Table in Power BI (Table Tools → Mark as Date Table).

🎯 Samjho Hinglish Mein: Socho tumhare Sales data mein dates hain — 01-Jan, 05-Jan, 12-Feb, 20-Mar... lekin beech ke dates (02-Jan, 03-Jan, 04-Jan...) missing hain kyunki un dinon sale nahi hui. Power BI ke Time Intelligence functions ko CONTINUOUS dates chahiye — har din ka record, chahe sale hui ya nahi. Isliye ek alag Calendar table banate hain jisme 01-Jan-2024 se 31-Dec-2024 tak SAARI dates hain — ek row per day. Phir is Calendar table ka Date column Sales table ke OrderDate se relationship banate hain. Ab YoY, MoM, Running Total — sab kaam karega!

💡 Date Table — Key Rules:
• Continuous: Start date se end date tak SAARI dates honi chahiye — no gaps. Agar data 2023-2024 ka hai toh 01-Jan-2023 se 31-Dec-2024 tak har date ek row mein.
• Unique: Har date sirf ek baar — no duplicates. Yeh Primary Key hai.
• Marked: Table Tools → "Mark as Date Table" → Date column select karo. Yeh Power BI ko batata hai ki yeh official calendar hai.
• Granularity: Date level (day level) honi chahiye — monthly ya yearly nahi. Time Intelligence functions daily granularity expect karte hain.
• Extra Columns: Year, Quarter (Q1-Q4), Month Number (1-12), Month Name (Jan-Dec), Day, Weekday, Financial Year — yeh sab calculated columns add karo analysis ke liye.

📊 Date Table — Sample Preview:

 Calendar Table (Date Dimension): ────────────────────────────────────────────────────────────────── Date │ Year │ Quarter │ MonthNum │ MonthName │ Day │ Weekday ────────────────────────────────────────────────────────────────── 01-Jan-2024 │ 2024 │ Q1 │ 1 │ January │ 1 │ Monday 02-Jan-2024 │ 2024 │ Q1 │ 1 │ January │ 2 │ Tuesday 03-Jan-2024 │ 2024 │ Q1 │ 1 │ January │ 3 │ Wednesday ... │ ... │ ... │ ... │ ... │ ... │ ... 31-Mar-2024 │ 2024 │ Q1 │ 3 │ March │ 31 │ Sunday 01-Apr-2024 │ 2024 │ Q2 │ 4 │ April │ 1 │ Monday ... │ ... │ ... │ ... │ ... │ ... │ ... 31-Dec-2024 │ 2024 │ Q4 │ 12 │ December │ 31 │ Tuesday ────────────────────────────────────────────────────────────────── Total Rows: 366 (2024 is leap year) Every single date from Jan 1 to Dec 31 — NO GAPS!

💻 Method 1 — DAX Calendar Table (Recommended):

// Modeling tab → New Table → Enter this DAX formula:
Calendar =
ADDCOLUMNS(
CALENDARAUTO(),
"Year", YEAR([Date]),
"Quarter", "Q" & QUARTER([Date]),
"MonthNum", MONTH([Date]),
"MonthName", FORMAT([Date], "MMMM"),
"Day", DAY([Date]),
"Weekday", FORMAT([Date], "dddd"),
"WeekdayNum", WEEKDAY([Date], 2),
"YearMonth", FORMAT([Date], "YYYY-MM")
)

// CALENDARAUTO() automatically detects min & max dates
// from all date columns in your model and creates
// a continuous date range covering full years.

💻 Method 2 — DAX CALENDAR with Manual Range:

// If you want to specify exact date range:
Calendar =
ADDCOLUMNS(
CALENDAR(
DATE(2023, 1, 1),
DATE(2024, 12, 31)
),
"Year", YEAR([Date]),
"Quarter", "Q" & QUARTER([Date]),
"MonthNum", MONTH([Date]),
"MonthName", FORMAT([Date], "MMMM"),
"Day", DAY([Date]),
"Weekday", FORMAT([Date], "dddd")
)

// CALENDAR(start_date, end_date) — manual range

// Use this when you want to control exact boundaries.

💻 Method 3 — Power Query Calendar Table:

// Power Query (M Language) approach: 
// Home → New Source → Blank Query → Advanced Editor:
let
StartDate = #date(2023, 1, 1),
EndDate = #date(2024, 12, 31),
Duration = Duration.Days(EndDate - StartDate) + 1,
DateList = List.Dates(StartDate, Duration, #duration(1,0,0,0)),
TableFromList = Table.FromList(DateList, Splitter.SplitByNothing()),
RenamedColumn = Table.RenameColumns(TableFromList, {{"Column1", "Date"}}),
ChangedType = Table.TransformColumnTypes(RenamedColumn, {{"Date", type date}})
in
ChangedType

// After this, add columns in Power Query for Year, Month, etc.

// Add Column → Date → Year, Month, Day, etc.

💻 Mark as Date Table — Critical Step:

// After creating the Calendar table: // // Step 1: Go to Data View // Step 2: Click
on the Calendar table // Step 3: Table Tools ribbon → "Mark as Date Table" // Step 4: Select the Date column as the date column // // WHY THIS IS CRITICAL: // - Power BI's auto date/time feature creates hidden date tables // - These hidden tables interfere with your custom Calendar // - Marking explicitly tells Power BI: "THIS is the date table" // - Time Intelligence DAX functions REQUIRE a marked date table // // BONUS: Disable auto date/time for better performance: // File → Options → Current File → Data Load → // Uncheck "Auto date/time for new files"

📊 Sort Month Name by Month Number:

PROBLEM: MonthName column sorts alphabetically: AprilAugustDecemberFebruary... ← WRONG!
FIX: Data ViewSelect MonthName column
Column Tools"Sort by Column"Select MonthNum
JanuaryFebruaryMarchApril... ← CORRECT! ✅
Same fix for WeekdaySort by WeekdayNum
📋 Pro Tip — Financial Year Calendar: Agar company ka financial year April se March hai (India mein common), toh Calendar table mein ek extra column add karo:
"FY", "FY " & IF(MONTH([Date]) >= 4, YEAR([Date]) & "-" & YEAR([Date])+1, YEAR([Date])-1 & "-" & YEAR([Date]))
Yeh "FY 2024-2025" jaisa value generate karega April 2024 onwards dates ke liye. Financial reporting ke liye essential hai.
⚡ Important — Without Date Table, These DAX Functions FAIL:
• TOTALYTD, TOTALQTD, TOTALMTD
• SAMEPERIODLASTYEAR, PREVIOUSMONTH, PREVIOUSYEAR
• DATEADD, DATESYTD, DATESBETWEEN
• PARALLELPERIOD
• Any YoY, MoM, Running Total calculations
Bina proper marked Date Table ke yeh saare functions error denge ya incorrect results return karenge. Date Table = Time Intelligence ka foundation.

⚠️ Common Mistakes:

  • Mistake: Sales table ke OrderDate column ko directly Time Intelligence mein use karna bina separate Date Table ke. Fix: Hamesha alag Calendar table banao aur ussey Sales[OrderDate] se relationship banao. OrderDate continuous nahi hai (missing dates) — Time Intelligence continuous dates expect karta hai.
  • Mistake: Date Table create ki lekin "Mark as Date Table" nahi kiya. Fix: Table select karo → Table Tools → Mark as Date Table → Date column select karo. Bina mark kiye Power BI apne hidden auto date tables use karega — conflict hoga.
  • Mistake: MonthName column alphabetically sort ho raha hai (April first instead of January). Fix: Data View → MonthName column → Column Tools → Sort by Column → MonthNum select karo.
  • Mistake: Calendar table mein gaps rehna (weekends ya holidays skip karna). Fix: Date Table mein SAARI dates honi chahiye — including weekends aur holidays. Agar analysis mein weekdays chahiye toh DAX mein filter karo, lekin table mein gap mat chhodho.
  • Mistake: CALENDARAUTO() use karna jab data mein bohot purani dates hain (1900-01-01 jaisi default values). Fix: CALENDARAUTO() model ki saari date columns ka min/max detect karta hai. Agar koi column mein 1900 date hai toh 1900 se start hoga — unnecessary! Pehle data clean karo ya CALENDAR() function mein manual range do.

💬 Interview Questions:

Q1: Power BI mein Date Table kyun zaroori hai?
Ans: Date Table Time Intelligence DAX functions ka foundation hai. Functions jaise TOTALYTD, SAMEPERIODLASTYEAR, DATEADD — yeh sab continuous date range expect karte hain. Sales table ka OrderDate column continuous nahi hota (jis din sale nahi hui, us din ka row nahi hai). Date Table mein har din ka ek row hota hai — no gaps. Isko Sales table se relationship connect karke Time Intelligence properly kaam karta hai. Bina Date Table ke YoY growth, running totals, period comparisons — sab fail hote hain.

Q2: CALENDAR aur CALENDARAUTO mein kya difference hai?
Ans: CALENDAR(start_date, end_date) mein hum manually date range specify karte hain — full control. CALENDARAUTO() automatically model ki saari date columns ko scan karta hai, minimum aur maximum dates detect karta hai, aur full years ka range generate karta hai (nearest January 1 to December 31 tak). CALENDARAUTO() convenient hai lekin risky — agar kisi column mein wrong dates hain (1900-01-01 default values) toh range unnecessarily bada ho jaayega. CALENDAR() safer hai kyunki range tumhare control mein hai.

Q3: "Mark as Date Table" kya karta hai aur kyun zaroori hai?
Ans: "Mark as Date Table" Power BI ko explicitly batata hai ki yeh table tumhari official date dimension hai. Iske baad: (1) Power BI apne hidden auto date/time tables disable karta hai us relationship ke liye — performance improve hoti hai. (2) Time Intelligence DAX functions properly work karte hain kyunki unhe marked date table chahiye. (3) Date hierarchy (Year → Quarter → Month → Day) properly available hoti hai. Bina mark kiye Power BI apne auto-generated hidden tables use karega — conflict aur incorrect results ho sakte hain.

Q4: Kya Date Table Power Query mein banana chahiye ya DAX mein?
Ans: Dono approaches kaam karti hain. DAX approach (CALENDAR/CALENDARAUTO + ADDCOLUMNS) zyada popular hai kyunki easy hai aur Power BI community mein widely used hai. Power Query approach M Language use karti hai — zyada flexible hai agar complex custom logic chahiye (custom holidays, fiscal calendars). Performance mein koi significant difference nahi hai. Choose karo jo team mein standard hai. Important yeh hai ki Date Table ban jaye — chahe kisi bhi method se.

Part 2 Summary — Quick Reference Table

Data Modeling ke saare core concepts ek nazar mein:

# Topic Key Takeaway Golden Rule
1 Tables & Relationships Fact = transactions, Dimension = descriptions Fact mein numbers, Dimension mein text/context
2 Star vs Snowflake Star Schema = Power BI optimized Flatten snowflakes into stars before loading
3 Keys (PK, FK, Composite) PK = unique in Dim, FK = repeating in Fact PK mein duplicates = broken model
4 Cardinality 1:N = 90% cases, M:N = avoid/bridge table M:N dekhte hi bridge table socho
5 Cross Filter Direction Single = default & safe, Both = special cases CROSSFILTER DAX > global Both direction
6 Date Table Continuous dates + Mark as Date Table = Time Intelligence No Date Table = No YoY, MoM, Running Totals

Next: Power BI Masterclass — Part 3

Agle part mein hum cover karenge: DAX Fundamentals — DAX Kya Hai, Calculated Columns vs Measures, Basic DAX Functions (SUM, AVERAGE, COUNT, COUNTA, DISTINCTCOUNT, MIN, MAX), CALCULATE, FILTER, ALL/ALLEXCEPT/ALLSELECTED, aur sabse important concept — Row Context vs Filter Context. Yeh DAX ka core hai — bina iske Power BI mein advanced analytics impossible hai. Previously completed: MySQL, Pandas, NumPy, Data Cleaning, Matplotlib, Seaborn, Plotly, Excel Masterclass — sab Data Insights par available hai.

Happy Learning & Keep Analyzing! 🚀

👤
Jatin Kumar
Data Analyst & Educator

Python, SQL, Power BI aur Excel mein practical tutorials likhta hoon — taaki data analytics seekhna aasan ho. Portfolio: jatinanalytics.co.in

Portfolio LinkedIn GitHub Kaggle All Articles
Share:

💬 Comments (0)

Spam/links allowed nahi hain — respectful comments welcome!

Loading comments...

Was this article helpful?
Previous ArticlePower BI Introduction And Setup: Complete Foundation GuideNext Article DAX Fundamentals — The Language of Power BI