<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Maina kelvin</title>
    <description>The latest articles on DEV Community by Maina kelvin (@kelmains).</description>
    <link>https://dev.to/kelmains</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3951201%2Fc222f075-dfad-44d9-8e53-9d1a768d0747.jpeg</url>
      <title>DEV Community: Maina kelvin</title>
      <link>https://dev.to/kelmains</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kelmains"/>
    <language>en</language>
    <item>
      <title>Data Modeling, Joins, Relationships, and Different Schemas in Power BI</title>
      <dc:creator>Maina kelvin</dc:creator>
      <pubDate>Mon, 29 Jun 2026 07:25:52 +0000</pubDate>
      <link>https://dev.to/kelmains/data-modeling-joins-relationships-and-different-schemas-in-power-bi-408n</link>
      <guid>https://dev.to/kelmains/data-modeling-joins-relationships-and-different-schemas-in-power-bi-408n</guid>
      <description>&lt;p&gt;Power BI is often sold on its visuals, sleek charts, interactive dashboards, and drill-throughs. But the truth every experienced Power BI developer learns quickly is this: &lt;strong&gt;a report is only as good as the data model underneath it.&lt;/strong&gt; A beautiful dashboard built on a poorly designed model will eventually break down with slow performance, incorrect totals, confusing filter behavior, or numbers that simply don't match what the business expects.&lt;/p&gt;

&lt;p&gt;This article walks through the core concepts that make or break a Power BI model: data modeling fundamentals, how relationships and "joins" actually work, and the most common schema designs used in real-world projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Why Data Modeling Matters More Than Visuals
&lt;/h2&gt;

&lt;p&gt;When you load data into Power BI from Excel, SQL Server, SharePoint, or any other source, you're not just importing rows and columns — you're building a &lt;strong&gt;semantic model&lt;/strong&gt; (formerly called a "data model"). This model defines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What tables exist&lt;/li&gt;
&lt;li&gt;How those tables relate to one another&lt;/li&gt;
&lt;li&gt;What calculations (measures) live on top of the data&lt;/li&gt;
&lt;li&gt;How filters flow from one table to another when a user clicks a slicer or visual&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Get this right, and your reports are fast, accurate, and easy to extend. Get it wrong, and you end up writing increasingly complicated DAX formulas to compensate for a structure that's fighting you the whole way (I learnt this the hard way😀😀)&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Power BI Doesn't Really Have "Joins" — It Has Relationships
&lt;/h2&gt;

&lt;p&gt;If you come from a SQL background, your instinct is to think in terms of &lt;code&gt;JOIN&lt;/code&gt; statements, &lt;code&gt;INNER JOIN&lt;/code&gt;, &lt;code&gt;LEFT JOIN&lt;/code&gt;, and so on. Power BI's Power Query (the data-loading layer) does support &lt;strong&gt;merge queries&lt;/strong&gt;, which behave as SQL joins, but that's only half the story.&lt;/p&gt;

&lt;h3&gt;
  
  
  Merges in Power Query (the "join" step)
&lt;/h3&gt;

&lt;p&gt;In Power Query, you can merge two tables using options that map directly to SQL join types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Left Outer&lt;/strong&gt; – all rows from the first table, matching rows from the second&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Right Outer&lt;/strong&gt; – all rows from the second table, matching rows from the first&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full Outer&lt;/strong&gt; – all rows from both tables&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inner&lt;/strong&gt; – only matching rows from both tables&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Left Anti&lt;/strong&gt; – only rows from the first table with &lt;em&gt;no&lt;/em&gt; match in the second&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Right Anti&lt;/strong&gt; – only rows from the second table with &lt;em&gt;no&lt;/em&gt; match in the first&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This happens during data transformation, &lt;em&gt;before&lt;/em&gt; the data lands in the model. It physically combines columns from two queries into one table.&lt;/p&gt;

&lt;h3&gt;
  
  
  Relationships in the Data Model (the real backbone)
&lt;/h3&gt;

&lt;p&gt;Once data is loaded, Power BI doesn't keep joining tables on the fly the way a SQL query would. Instead, you define &lt;strong&gt;relationships&lt;/strong&gt; between tables — logical links based on matching key columns (usually IDs). At query time, the engine uses these relationships to filter and aggregate data across tables without physically merging them.&lt;/p&gt;

&lt;p&gt;This is the more important concept for 90% of Power BI work. Most well-modeled reports rarely need Power Query merges at all — they rely on relationships instead, because relationships are faster, more flexible, and easier to maintain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key takeaway:&lt;/strong&gt; Use merges in Power Query when you need to combine columns into a single physical table (e.g., enriching a table with a lookup value). Use relationships when you want two tables to interact dynamically in visuals and filters.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Anatomy of a Relationship
&lt;/h2&gt;

&lt;p&gt;Every relationship in Power BI has three defining characteristics:&lt;/p&gt;

&lt;h3&gt;
  
  
  a) Cardinality
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One-to-many (1:*)&lt;/strong&gt; – the most common and recommended type. One row in a "lookup" table (e.g., Customer) relates to many rows in a "data" table (e.g., Sales).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Many-to-many (&lt;em&gt;:&lt;/em&gt;)&lt;/strong&gt; – both tables can have duplicate key values. Useful but riskier; can cause ambiguous aggregations if not handled carefully.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One-to-one (1:1)&lt;/strong&gt; – rare; usually signals the two tables should be merged into one.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  b) Cross-Filter Direction
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Single direction&lt;/strong&gt; – filters flow one way only (typically from the "one" side to the "many" side). This is the default and the safest choice for most star-schema models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bidirectional&lt;/strong&gt; – filters flow both ways. Powerful but can introduce ambiguity and performance issues if overused. Use sparingly and intentionally.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  c) Active vs. Inactive
&lt;/h3&gt;

&lt;p&gt;A pair of tables can have multiple relationships, but only one can be &lt;strong&gt;active&lt;/strong&gt; at a time (shown as a solid line; inactive ones are dashed). Inactive relationships can still be used in DAX via the &lt;code&gt;USERELATIONSHIP&lt;/code&gt; function — this is common when, for example, a Sales table has both an "Order Date" and a "Ship Date" that both relate to a Date table.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Star Schema: The Gold Standard
&lt;/h2&gt;

&lt;p&gt;The most recommended structure in Power BI (and in data warehousing generally) is the &lt;strong&gt;star schema&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structure:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One or more &lt;strong&gt;fact tables&lt;/strong&gt; in the center — these hold transactional/event data with measures (Sales, Orders, Clicks, etc.) and lots of rows.&lt;/li&gt;
&lt;li&gt;Several &lt;strong&gt;dimension tables&lt;/strong&gt; around it — these hold descriptive attributes (Customer, Product, Date, Region) with relatively few rows.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        Dim_Customer
              |
Dim_Product — Fact_Sales — Dim_Date
              |
         Dim_Region
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why star schema works so well in Power BI
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt; — Power BI's VertiPaq engine (the in-memory columnar storage engine) is optimized for this shape. Compression is more efficient when descriptive text lives in small dimension tables rather than being repeated millions of times in a fact table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simplicity for DAX&lt;/strong&gt; — Filters propagate cleanly from dimensions to facts in a single direction, which avoids ambiguous calculation paths.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reusability&lt;/strong&gt; — A single Date or Customer dimension table can filter multiple fact tables at once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easier maintenance&lt;/strong&gt; — Business logic and hierarchies (e.g., Year &amp;gt; Quarter &amp;gt; Month) live in one place, not scattered across many tables.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  5. Snowflake Schema: Star Schema's More Normalized Cousin
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;snowflake schema&lt;/strong&gt; takes the star schema and normalizes the dimension tables further — breaking a dimension into multiple related sub-tables.&lt;/p&gt;

&lt;p&gt;For example, instead of one flat &lt;code&gt;Dim_Product&lt;/code&gt; table containing Product Name, Category, and Subcategory, a snowflake schema would split this into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Dim_Product — Dim_Subcategory — Dim_Category
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When it happens:&lt;/strong&gt; Often it's not a deliberate design choice but a side effect of importing data directly from a normalized relational database (like a transactional SQL system) without reshaping it first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trade-offs:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Saves storage space in the source system (less relevant in Power BI, since VertiPaq compression already handles repeated text efficiently)&lt;/li&gt;
&lt;li&gt;❌ More relationships to maintain&lt;/li&gt;
&lt;li&gt;❌ Filters have to "hop" through more tables, which can hurt both performance and DAX clarity&lt;/li&gt;
&lt;li&gt;❌ More complex for report builders and end users browsing the field list&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;General guidance:&lt;/strong&gt; In Power BI, it's usually better to flatten snowflake structures into a clean star schema during the Power Query stage, rather than leaving multiple small dimension tables chained together. Fewer, wider dimension tables almost always outperform many narrow, linked ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Other Schema Patterns Worth Knowing
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Galaxy Schema (Fact Constellation)
&lt;/h3&gt;

&lt;p&gt;Multiple fact tables share common dimension tables. For example, &lt;code&gt;Fact_Sales&lt;/code&gt; and &lt;code&gt;Fact_Returns&lt;/code&gt; might both connect to &lt;code&gt;Dim_Product&lt;/code&gt; and &lt;code&gt;Dim_Date&lt;/code&gt;. This is very common in real business models and is essentially "multiple stars sharing points."&lt;/p&gt;

&lt;h3&gt;
  
  
  Single Flat Table
&lt;/h3&gt;

&lt;p&gt;Everything crammed into one wide table — no relationships needed. This works for very small, simple datasets but breaks down quickly: it bloats file size, slows down calculations, and makes time intelligence and reusable hierarchies much harder to manage. Generally discouraged once you have more than a trivial dataset.&lt;/p&gt;

&lt;h3&gt;
  
  
  Many-to-Many Bridge Tables
&lt;/h3&gt;

&lt;p&gt;Sometimes two dimensions have a natural many-to-many relationship (e.g., Customers who can belong to multiple Sales Regions). Rather than forcing a direct many-to-many relationship, best practice is often to introduce a &lt;strong&gt;bridge table&lt;/strong&gt; that resolves the relationship into two clean one-to-many links.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Practical Best Practices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Build a dedicated Date table&lt;/strong&gt; and mark it as a date table in Power BI. This unlocks time intelligence functions (&lt;code&gt;SAMEPERIODLASTYEAR&lt;/code&gt;, &lt;code&gt;TOTALYTD&lt;/code&gt;, etc.) and avoids inconsistent date handling across fact tables.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hide foreign keys&lt;/strong&gt; used only for relationships from the report view, so end users aren't confused by raw ID columns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prefer single-direction filtering&lt;/strong&gt; unless you have a specific, well-understood reason for bidirectional filters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Avoid circular relationships&lt;/strong&gt; — Power BI won't allow two active relationships to create a loop, so plan your model before connecting everything to everything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Name tables and columns for business users&lt;/strong&gt;, not database administrators — &lt;code&gt;Customer Name&lt;/code&gt;, not &lt;code&gt;cust_nm_txt&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Power Query to reshape, not the model to compensate.&lt;/strong&gt; If your model is awkward, it's often because the data wasn t cleaned or flattened enough upstream.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  8. Conceptual Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concept&lt;/th&gt;
&lt;th&gt;What It Does&lt;/th&gt;
&lt;th&gt;Where It Happens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Merge (Join)&lt;/td&gt;
&lt;td&gt;Physically combines two tables' columns based on a key&lt;/td&gt;
&lt;td&gt;Power Query&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Relationship&lt;/td&gt;
&lt;td&gt;Logically links tables so filters flow between them&lt;/td&gt;
&lt;td&gt;Data Model (Model View)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Star Schema&lt;/td&gt;
&lt;td&gt;Fact table(s) surrounded by denormalized dimensions&lt;/td&gt;
&lt;td&gt;Model design&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Snowflake Schema&lt;/td&gt;
&lt;td&gt;Dimensions normalized into sub-tables&lt;/td&gt;
&lt;td&gt;Model design&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Galaxy Schema&lt;/td&gt;
&lt;td&gt;Multiple fact tables sharing dimensions&lt;/td&gt;
&lt;td&gt;Model design&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bridge Table&lt;/td&gt;
&lt;td&gt;Resolves many-to-many relationships cleanly&lt;/td&gt;
&lt;td&gt;Model design&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Power BI rewards modelers who think like data architects, not spreadsheet users. The temptation to import everything as one giant flat table, or to lean on Power Query merges for everything, usually leads to a model that's slow and brittle. Investing time upfront in a clean star schema — with well-defined relationships, a proper date table, and sensible cardinality — pays off every time someone adds a new report, a new measure, or a new data source down the line.&lt;/p&gt;

&lt;p&gt;Good data modeling isn't the flashy part of Power BI. But it's the part that determines whether everything else actually works.&lt;/p&gt;

</description>
      <category>analytics</category>
      <category>data</category>
      <category>microsoft</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How Excel Is Used in Real-World Data Analysis</title>
      <dc:creator>Maina kelvin</dc:creator>
      <pubDate>Sun, 07 Jun 2026 16:31:14 +0000</pubDate>
      <link>https://dev.to/kelmains/how-excel-is-used-in-real-world-data-analysis-495a</link>
      <guid>https://dev.to/kelmains/how-excel-is-used-in-real-world-data-analysis-495a</guid>
      <description>&lt;p&gt;&lt;strong&gt;What Is Excel?&lt;/strong&gt;&lt;br&gt;
Excel is a tool made by Microsoft that helps you work with numbers and data. You use it to organize information in rows and columns, do calculations, and create charts. It looks simple at first, but the more you use it, the more you realize how much it can do. It's one of the most widely used tools in offices around the world.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ways Excel Is Used in Real Life&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Managing Money and Budgets Businesses use Excel to keep track of how much money is coming in and going out. For example, a small shop owner can use it to record daily sales and see at the end of the month whether they made a profit or a loss. It makes financial tracking much easier.&lt;/li&gt;
&lt;li&gt;Tracking Marketing Results When a company runs an ad or a campaign, they need to know if it worked. Excel helps them collect the numbers, like how many people clicked, how many bought something, and compare results over time. This helps them decide what to do more of and what to stop.&lt;/li&gt;
&lt;li&gt;Managing Stock and Supplies Shops and warehouses use Excel to know how much stock they have. When something is running low, Excel can help flag it. This stops businesses from running out of important items.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Excel Features Worth Knowing&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Conditional Formatting is a way of making your data speak for itself. Instead of reading every cell one by one, you set rules and Excel highlights what matters. For example, you can make all sales above a target turn green and anything below turn red. This is very helpful when you are working with a large sheet and need to quickly see what is doing well and what needs attention.&lt;/li&gt;
&lt;li&gt;Using Formulas: Instead of doing calculations by hand, you type a formula and Excel does the work for you. Simple ones like SUM and AVERAGE help you add up numbers or find the middle value in a list. More advanced ones, like IF let you make decisions for example, "if this number is above 100, write Pass, if not, write Fail." Once you get comfortable with formulas, you can solve a lot of problems very fast.&lt;/li&gt;
&lt;li&gt;Filters and Advanced Filters: This lets you narrow down your data, so you only see what you need. For example, if you have a list of 500 customers, you can filter to only show customers from Nairobi, or only those who made a purchase in the last 30 days. Advanced filters go even further you can set multiple conditions at once to get very specific results. This saves a lot of time when working with big datasets.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;My Reflection&lt;/strong&gt;&lt;br&gt;
Before I started learning Excel, looking at a spreadsheet full of numbers felt overwhelming. I didn't know where to start or what any of it meant. But as I learned more, things started to make sense. &lt;/p&gt;

</description>
      <category>excellfordata</category>
      <category>data</category>
      <category>datascience</category>
    </item>
  </channel>
</rss>
