<?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>Forem: Jill Nandaha</title>
    <description>The latest articles on Forem by Jill Nandaha (@nandaha).</description>
    <link>https://forem.com/nandaha</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3498079%2Fc6b96ff3-2e81-43d6-9efb-e12e86d0854c.jpg</url>
      <title>Forem: Jill Nandaha</title>
      <link>https://forem.com/nandaha</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nandaha"/>
    <language>en</language>
    <item>
      <title>Connecting Power BI to a SQL Database: A Complete Guide</title>
      <dc:creator>Jill Nandaha</dc:creator>
      <pubDate>Fri, 13 Mar 2026 08:43:18 +0000</pubDate>
      <link>https://forem.com/nandaha/connecting-power-bi-to-a-sql-database-a-complete-guide-2do1</link>
      <guid>https://forem.com/nandaha/connecting-power-bi-to-a-sql-database-a-complete-guide-2do1</guid>
      <description>&lt;h2&gt;
  
  
  Introduction: Power BI and the Role of SQL Databases
&lt;/h2&gt;

&lt;p&gt;In today's data-driven world, businesses generate enormous amounts of information every single day — from sales transactions to customer interactions, inventory movements, and beyond. Making sense of all that data requires the right tools. &lt;strong&gt;Microsoft Power BI&lt;/strong&gt; is one of the most widely used business intelligence platforms in the world, and for good reason.&lt;/p&gt;

&lt;p&gt;Power BI is a data visualization and analytics tool that allows analysts, data professionals, and business users to connect to data sources, transform raw data, build interactive dashboards, and share insights across an organization. With drag-and-drop simplicity and powerful underlying query capabilities, it enables even non-technical stakeholders to explore trends, track KPIs, and make data-backed decisions in real time.&lt;/p&gt;

&lt;p&gt;But Power BI is only as good as the data it connects to. That's where &lt;strong&gt;SQL databases&lt;/strong&gt; come in.&lt;/p&gt;

&lt;p&gt;SQL (Structured Query Language) databases — such as PostgreSQL, MySQL, and Microsoft SQL Server — are the backbone of most modern data infrastructure. They store structured, relational data in an organized, queryable format. Companies rely on SQL databases because they are reliable, scalable, and optimized for both storing and retrieving large volumes of analytical data.&lt;/p&gt;

&lt;p&gt;When companies connect Power BI to a SQL database, they unlock the ability to build live, always-updated dashboards powered by real production data — no more manually exported spreadsheets, no more stale reports. The combination of SQL's data management strengths and Power BI's visualization capabilities is one of the most powerful setups in modern business intelligence.&lt;/p&gt;

&lt;p&gt;In this article, you'll learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to connect Power BI to a &lt;strong&gt;local PostgreSQL database&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;How to connect to a &lt;strong&gt;cloud PostgreSQL database on Aiven&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;How to load and &lt;strong&gt;model your tables&lt;/strong&gt; in Power BI&lt;/li&gt;
&lt;li&gt;Why &lt;strong&gt;SQL skills matter&lt;/strong&gt; even when using a visual tool like Power BI&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Part 1: Connecting Power BI to a Local PostgreSQL Database
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before you begin, make sure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Power BI Desktop&lt;/strong&gt; installed (download free from &lt;a href="https://powerbi.microsoft.com" rel="noopener noreferrer"&gt;powerbi.microsoft.com&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PostgreSQL&lt;/strong&gt; installed and running locally&lt;/li&gt;
&lt;li&gt;A database with tables already created (e.g., &lt;code&gt;customers&lt;/code&gt;, &lt;code&gt;products&lt;/code&gt;, &lt;code&gt;sales&lt;/code&gt;, &lt;code&gt;inventory&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;PostgreSQL ODBC driver&lt;/strong&gt; or the &lt;strong&gt;Npgsql&lt;/strong&gt; connector installed&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Step 1: Open Power BI Desktop
&lt;/h3&gt;

&lt;p&gt;Launch Power BI Desktop. You'll land on the Home screen showing recent reports and quick-start options.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Screenshot: Power BI Desktop home screen&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffm40rban8kbyltiplt8z.png" alt="Power BI Desktop home screen" width="800" height="468"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 2: Click "Get Data"
&lt;/h3&gt;

&lt;p&gt;On the &lt;strong&gt;Home&lt;/strong&gt; ribbon at the top, click the &lt;strong&gt;Get Data&lt;/strong&gt; button. A dropdown will appear with common data source categories.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Screenshot: "Get Data" button highlighted on the Home ribbon&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fut0h946vd8khvzwh9aiv.png" alt="" width="800" height="493"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 3: Select "PostgreSQL Database"
&lt;/h3&gt;

&lt;p&gt;In the Get Data dialog box, either search for "PostgreSQL" in the search bar, or navigate to the &lt;strong&gt;Database&lt;/strong&gt; category on the left panel. Select &lt;strong&gt;PostgreSQL Database&lt;/strong&gt; and click &lt;strong&gt;Connect&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Screenshot: Get Data dialog with "PostgreSQL Database" selected&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8zjnc8yrxuk2lt2ee8l.png" alt="Get Data dialog with " width="800" height="434"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 4: Enter Server and Database Details
&lt;/h3&gt;

&lt;p&gt;A connection dialog will appear asking for two fields:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;What to Enter&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Server&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;localhost&lt;/code&gt; (for a local database)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Database&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The name of your PostgreSQL database (e.g., &lt;code&gt;sales_db&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can also expand &lt;strong&gt;Advanced Options&lt;/strong&gt; to write a custom SQL query if you don't want to load entire tables.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Screenshot: PostgreSQL connection dialog showing the Server and Database fields&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Click &lt;strong&gt;OK&lt;/strong&gt; to proceed.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd0y6j80y2er2o839zcim.png" alt="PostgreSQL connection dialog showing the Server and Database fields" width="800" height="452"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 5: Enter Your Credentials
&lt;/h3&gt;

&lt;p&gt;Power BI will prompt you for authentication. Choose &lt;strong&gt;Database&lt;/strong&gt; authentication, then enter your &lt;strong&gt;PostgreSQL username&lt;/strong&gt; and &lt;strong&gt;password&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Screenshot: Credentials dialog with Database authentication selected&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Click &lt;strong&gt;Connect&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq4s5edikmw6cdnsk48nz.png" alt="Credentials dialog with Database authentication selected" width="800" height="424"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 6: Select Tables to Load
&lt;/h3&gt;

&lt;p&gt;The &lt;strong&gt;Navigator&lt;/strong&gt; window will open, showing all available schemas and tables in your database. Check the boxes next to the tables you want to load — for example: &lt;code&gt;customers&lt;/code&gt;, &lt;code&gt;products&lt;/code&gt;, &lt;code&gt;sales&lt;/code&gt;, and &lt;code&gt;inventory&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You'll see a preview of the selected table's data on the right side.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Screenshot: Navigator pane showing table list with checkboxes and a data preview&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Click &lt;strong&gt;Load&lt;/strong&gt; to import the tables directly, or &lt;strong&gt;Transform Data&lt;/strong&gt; to open the Power Query editor for data cleaning first.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F00xxn2cid83sm9xhmyfw.png" alt="Navigator pane showing table list with checkboxes and a data preview" width="800" height="479"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Part 2: Connecting Power BI to a Cloud PostgreSQL Database (Aiven)
&lt;/h2&gt;

&lt;p&gt;Many organizations don't run databases on local machines — they use cloud-hosted databases for scalability and availability. &lt;strong&gt;Aiven&lt;/strong&gt; is a popular managed cloud database service that supports PostgreSQL. Connecting to it from Power BI requires a few extra steps, particularly around &lt;strong&gt;SSL security&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  Step 1: Get Your Connection Details from Aiven
&lt;/h3&gt;

&lt;p&gt;Log in to your &lt;a href="https://console.aiven.io" rel="noopener noreferrer"&gt;Aiven Console&lt;/a&gt;. Navigate to your PostgreSQL service. On the &lt;strong&gt;Overview&lt;/strong&gt; tab, you'll find all the connection details you need:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Detail&lt;/th&gt;
&lt;th&gt;Example Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Host&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pg-yourservice.aivencloud.com&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Port&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;12345&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Database&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;defaultdb&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Username&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;avnadmin&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Password&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;(shown in the console)&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Screenshot: Aiven console showing connection details for a PostgreSQL service&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkqqsewvm6j1nkq61ael7.png" alt="Aiven console showing connection details for a PostgreSQL service" width="800" height="372"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 2: Download the SSL Certificate
&lt;/h3&gt;

&lt;p&gt;Still on the Aiven Overview page, scroll down to the &lt;strong&gt;Connection Information&lt;/strong&gt; section. Click &lt;strong&gt;Download CA Certificate&lt;/strong&gt; to download the &lt;code&gt;ca.pem&lt;/code&gt; file. Save it somewhere accessible on your machine (e.g., &lt;code&gt;C:\certs\ca.pem&lt;/code&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Screenshot: Aiven "Download CA Certificate" button&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2xt5u9uaotg4cnawz7f0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2xt5u9uaotg4cnawz7f0.png" alt="Aiven " width="800" height="64"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Why Is an SSL Certificate Required?
&lt;/h4&gt;

&lt;p&gt;When connecting to a cloud database over the internet, your credentials and data travel across public networks. An &lt;strong&gt;SSL (Secure Sockets Layer) certificate&lt;/strong&gt; encrypts this connection, ensuring that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your data cannot be intercepted by third parties (man-in-the-middle attacks)&lt;/li&gt;
&lt;li&gt;The server you're connecting to is verified and legitimate&lt;/li&gt;
&lt;li&gt;Your username and password are transmitted securely&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Aiven enforces SSL by default on all connections, which is a security best practice.&lt;/p&gt;




&lt;h3&gt;
  
  
  Step 3: Connect in Power BI
&lt;/h3&gt;

&lt;p&gt;Follow the same steps as the local connection:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Get Data → PostgreSQL Database&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;In the Server field, enter your Aiven &lt;strong&gt;host:port&lt;/strong&gt; (e.g., &lt;code&gt;pg-yourservice.aivencloud.com:12345&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Enter your &lt;strong&gt;database name&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Expand &lt;strong&gt;Advanced Options&lt;/strong&gt; and paste the following into the &lt;strong&gt;Additional Connection Parameters&lt;/strong&gt; field:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight properties"&gt;&lt;code&gt;&lt;span class="py"&gt;sslmode&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;require;sslrootcert=C:&lt;/span&gt;&lt;span class="se"&gt;\c&lt;/span&gt;&lt;span class="s"&gt;erts&lt;/span&gt;&lt;span class="se"&gt;\c&lt;/span&gt;&lt;span class="s"&gt;a.pem&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Screenshot: PostgreSQL connection dialog with Aiven host and SSL parameters filled in&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbbj85bxswkmramycwx8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbbj85bxswkmramycwx8.png" alt="PostgreSQL connection dialog with Aiven host and SSL parameters filled in" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enter your &lt;strong&gt;Aiven username and password&lt;/strong&gt; when prompted&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Connect&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once authenticated, the Navigator will appear just like with a local database — select your tables and load them in.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 3: Loading Tables and Building Relationships
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Loading the Tables
&lt;/h3&gt;

&lt;p&gt;After clicking &lt;strong&gt;Load&lt;/strong&gt; in the Navigator, Power BI will import your selected tables. In this case, we're working with four tables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;customers&lt;/strong&gt; — customer profiles and contact information&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;products&lt;/strong&gt; — product catalog with pricing and categories&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;sales&lt;/strong&gt; — transactional records linking customers to products&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;inventory&lt;/strong&gt; — stock levels per product&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once loaded, these tables appear in the &lt;strong&gt;Data&lt;/strong&gt; pane on the right side of Power BI Desktop.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Screenshot: Power BI Data pane showing the four loaded tables&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1wui07133nrm6ku7rh6u.png" alt="Power BI Data pane showing the four loaded tables" width="800" height="465"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Creating Relationships in the Model View
&lt;/h3&gt;

&lt;p&gt;Click the &lt;strong&gt;Model&lt;/strong&gt; icon on the left sidebar (it looks like a diagram with connected boxes). Power BI often auto-detects relationships, but you should always verify them manually.&lt;/p&gt;

&lt;p&gt;Here's how the relationships between our four tables should look:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;customers ──────────── sales ──────────── products
  (customer_id)    (customer_id, product_id)  (product_id)
                          │
                     inventory
                     (product_id)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To create or edit a relationship:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Drag a field from one table onto the matching field in another (e.g., drag &lt;code&gt;customer_id&lt;/code&gt; from &lt;code&gt;customers&lt;/code&gt; to &lt;code&gt;sales&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Power BI will draw a line representing the relationship&lt;/li&gt;
&lt;li&gt;Double-click the line to set the &lt;strong&gt;Cardinality&lt;/strong&gt; (e.g., One-to-Many) and &lt;strong&gt;Cross-filter direction&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Screenshot: Model view showing relationships between customers, sales, products, and inventory&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1cdfzoswnyiljxqbl7uu.png" alt="Model view showing relationships between customers, sales, products, and inventory" width="800" height="282"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why Relationships Matter: A Note on Data Modeling
&lt;/h3&gt;

&lt;p&gt;Data modeling is the process of defining how tables relate to one another so that the BI tool can correctly aggregate and filter data. Without relationships:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A sales report can't look up a customer's name from the customers table&lt;/li&gt;
&lt;li&gt;A product performance chart can't match sales figures to product categories&lt;/li&gt;
&lt;li&gt;Filters applied to one table won't propagate correctly to related visuals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With properly defined relationships, Power BI's engine knows how to &lt;strong&gt;join tables automatically&lt;/strong&gt; whenever you drag fields from different tables into the same visual — no manual SQL joins required on your end.&lt;/p&gt;

&lt;p&gt;The key concept here is the &lt;strong&gt;star schema&lt;/strong&gt; model: one central fact table (&lt;code&gt;sales&lt;/code&gt;) surrounded by dimension tables (&lt;code&gt;customers&lt;/code&gt;, &lt;code&gt;products&lt;/code&gt;, &lt;code&gt;inventory&lt;/code&gt;). This structure is optimized for analytics and is the standard data modeling pattern in Power BI.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Screenshot: Example of a completed star schema in Power BI model view&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9h5tzc0bgavltg6qrsbx.png" alt="Example of a completed star schema in Power BI model view" width="800" height="303"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Part 4: Why SQL Skills Matter for Power BI Analysts
&lt;/h2&gt;

&lt;p&gt;Power BI handles a lot automatically — it connects to databases, creates visuals, and even suggests relationships. So why does a Power BI analyst need to know SQL?&lt;/p&gt;

&lt;p&gt;The answer is: because Power BI is a &lt;em&gt;presentation layer&lt;/em&gt;, not a data preparation layer. The real work often happens before a single chart is built.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Retrieving Only What You Need
&lt;/h3&gt;

&lt;p&gt;Loading an entire table with millions of rows into Power BI slows everything down. With SQL, you can write a query that pulls only the columns and rows relevant to your analysis:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;signup_date&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;customers&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;signup_date&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="s1"&gt;'2023-01-01'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Power BI's &lt;strong&gt;Get Data → Advanced Options&lt;/strong&gt;, you can paste this query directly instead of loading the full table.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Filtering Datasets Before Import
&lt;/h3&gt;

&lt;p&gt;Rather than filtering data inside Power BI (which still loads the full table first), SQL lets you filter at the source — much more efficient:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;sales&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;sale_date&lt;/span&gt; &lt;span class="k"&gt;BETWEEN&lt;/span&gt; &lt;span class="s1"&gt;'2024-01-01'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="s1"&gt;'2024-12-31'&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'completed'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  3. Performing Aggregations at the Database Level
&lt;/h3&gt;

&lt;p&gt;Aggregating millions of rows in SQL before sending data to Power BI is faster than letting Power BI do it after loading everything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;quantity&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unit_price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;total_revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;DISTINCT&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;unique_customers&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;sales&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;product_id&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;category&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;total_revenue&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This kind of pre-aggregated table is perfect to load into Power BI as a summary dataset.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Preparing and Cleaning Data
&lt;/h3&gt;

&lt;p&gt;Real-world data is messy. SQL lets you handle duplicates, fill nulls, standardize formats, and combine tables before they ever reach Power BI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;UPPER&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;TRIM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;COALESCE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'no-email@unknown.com'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;region&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;customers&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  The Bottom Line
&lt;/h3&gt;

&lt;p&gt;SQL gives Power BI analysts &lt;strong&gt;control, speed, and precision&lt;/strong&gt; over their data pipeline. A developer who understands both SQL and Power BI can build dashboards that are not only visually compelling but also performant, accurate, and scalable.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Connecting Power BI to a SQL database — whether local or cloud-hosted — is a foundational skill for anyone working in data analytics or business intelligence. In this article, we walked through the full process: from clicking &lt;strong&gt;Get Data&lt;/strong&gt; in Power BI Desktop, to configuring secure SSL connections for cloud databases like Aiven, to loading and modeling tables for accurate analysis.&lt;/p&gt;

&lt;p&gt;We also saw that SQL knowledge isn't just a "nice to have" — it's what separates analysts who build fast, clean dashboards from those constantly fighting performance issues and data quality problems.&lt;/p&gt;

&lt;p&gt;As you build more complex Power BI reports, you'll find yourself reaching for SQL more and more — not because Power BI can't handle things on its own, but because the best analysts know &lt;em&gt;when&lt;/em&gt; to push work to the database and &lt;em&gt;when&lt;/em&gt; to let the visualization tool take over.&lt;/p&gt;

&lt;p&gt;Happy building! &lt;/p&gt;

</description>
      <category>powerbi</category>
      <category>analytics</category>
    </item>
    <item>
      <title>SQL Joins and Window Functions: A Developer's Guide</title>
      <dc:creator>Jill Nandaha</dc:creator>
      <pubDate>Mon, 02 Mar 2026 08:48:50 +0000</pubDate>
      <link>https://forem.com/nandaha/sql-joins-and-window-functions-a-developers-guide-dod</link>
      <guid>https://forem.com/nandaha/sql-joins-and-window-functions-a-developers-guide-dod</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;If you've ever worked with relational databases, you've almost certainly needed to combine data from multiple tables or perform calculations across related rows. That's exactly where &lt;strong&gt;Joins&lt;/strong&gt; and &lt;strong&gt;Window Functions&lt;/strong&gt; shine. These two SQL features are among the most powerful tools in a developer's toolkit — yet they're often misunderstood or underused.&lt;/p&gt;

&lt;p&gt;In this article, we'll break them down clearly, write real queries, and make sure you walk away with a solid mental model of both.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 1: SQL Joins
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What Are Joins?
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Join&lt;/strong&gt; is SQL's way of combining rows from two or more tables based on a related column between them. Think of it like merging two spreadsheets based on a shared ID column.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of Joins
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Join Type&lt;/th&gt;
&lt;th&gt;What It Returns&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;INNER JOIN&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Only rows that match in &lt;strong&gt;both&lt;/strong&gt; tables&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;LEFT JOIN&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;All rows from the left table + matching rows from the right&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;RIGHT JOIN&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;All rows from the right table + matching rows from the left&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;FULL OUTER JOIN&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;All rows from both tables, with NULLs where there's no match&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CROSS JOIN&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Every combination of rows from both tables (Cartesian product)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;SELF JOIN&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A table joined with itself&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Sample Tables
&lt;/h3&gt;

&lt;p&gt;Let's use two simple tables throughout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- employees table&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;emp_id&lt;/span&gt;    &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;      &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;dept_id&lt;/span&gt;   &lt;span class="nb"&gt;INT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;salary&lt;/span&gt;    &lt;span class="nb"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;-- departments table&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;departments&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;dept_id&lt;/span&gt;   &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;dept_name&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;emp_id&lt;/th&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dept_id&lt;/th&gt;
&lt;th&gt;salary&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Alice&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;70000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Bob&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;55000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Carol&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;80000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;David&lt;/td&gt;
&lt;td&gt;NULL&lt;/td&gt;
&lt;td&gt;45000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;dept_id&lt;/th&gt;
&lt;th&gt;dept_name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;Engineering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;Marketing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;30&lt;/td&gt;
&lt;td&gt;HR&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  INNER JOIN — The Most Common Join
&lt;/h3&gt;

&lt;p&gt;Returns only employees who belong to a department that exists.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;INNER&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;departments&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dept_name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Alice&lt;/td&gt;
&lt;td&gt;Engineering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bob&lt;/td&gt;
&lt;td&gt;Marketing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Carol&lt;/td&gt;
&lt;td&gt;Engineering&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;David is excluded because he has no &lt;code&gt;dept_id&lt;/code&gt;, and HR is excluded because no employee belongs to it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  LEFT JOIN — Include Everyone from the Left
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;LEFT&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;departments&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dept_name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Alice&lt;/td&gt;
&lt;td&gt;Engineering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bob&lt;/td&gt;
&lt;td&gt;Marketing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Carol&lt;/td&gt;
&lt;td&gt;Engineering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;David&lt;/td&gt;
&lt;td&gt;NULL&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;David appears with a NULL department — the left table (employees) keeps all its rows.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  FULL OUTER JOIN — Show Everything
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;FULL&lt;/span&gt; &lt;span class="k"&gt;OUTER&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;departments&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dept_name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Alice&lt;/td&gt;
&lt;td&gt;Engineering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bob&lt;/td&gt;
&lt;td&gt;Marketing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Carol&lt;/td&gt;
&lt;td&gt;Engineering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;David&lt;/td&gt;
&lt;td&gt;NULL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NULL&lt;/td&gt;
&lt;td&gt;HR&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;HR appears even though no employee belongs to it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  SELF JOIN — Joining a Table with Itself
&lt;/h3&gt;

&lt;p&gt;Useful for hierarchical data (e.g., employees and their managers).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Assume employees table has a manager_id column&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;employee&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;manager&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;LEFT&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;manager_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emp_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Part 2: Window Functions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What Are Window Functions?
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Window Function&lt;/strong&gt; performs a calculation across a set of rows that are somehow related to the current row — without collapsing those rows into a single result (unlike &lt;code&gt;GROUP BY&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Think of it like this: &lt;code&gt;GROUP BY&lt;/code&gt; squishes rows together. Window functions &lt;em&gt;look across&lt;/em&gt; rows while keeping each row intact.&lt;/p&gt;

&lt;p&gt;The basic syntax is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;function_name&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;PARTITION&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;column&lt;/span&gt;    &lt;span class="c1"&gt;-- divide into groups&lt;/span&gt;
    &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;column&lt;/span&gt;        &lt;span class="c1"&gt;-- sort within each group&lt;/span&gt;
    &lt;span class="k"&gt;ROWS&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="k"&gt;RANGE&lt;/span&gt; &lt;span class="n"&gt;clause&lt;/span&gt;      &lt;span class="c1"&gt;-- define the "frame"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Common Window Functions
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Function&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ROW_NUMBER()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Assigns a unique row number per partition&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;RANK()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Ranks rows; ties get the same rank, next rank skips&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DENSE_RANK()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Like RANK, but no gaps after ties&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;NTILE(n)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Divides rows into n roughly equal buckets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;LAG()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Access a previous row's value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;LEAD()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Access a next row's value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;SUM() OVER&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Running/cumulative sum&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;AVG() OVER&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Moving average&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;FIRST_VALUE()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;First value in the window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;LAST_VALUE()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Last value in the window&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  ROW_NUMBER() — Rank Within a Group
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ROW_NUMBER&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;PARTITION&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;dept_id&lt;/span&gt; &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;rank_in_dept&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dept_id&lt;/th&gt;
&lt;th&gt;salary&lt;/th&gt;
&lt;th&gt;rank_in_dept&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Carol&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;80000&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alice&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;70000&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bob&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;55000&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Each department gets its own ranking. Carol is #1 in Engineering, Bob is #1 in Marketing.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  RANK() vs DENSE_RANK() — Handling Ties
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;RANK&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;       &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;rank&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;DENSE_RANK&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;dense_rank&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Result (with a tie at 70000):&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;salary&lt;/th&gt;
&lt;th&gt;rank&lt;/th&gt;
&lt;th&gt;dense_rank&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Carol&lt;/td&gt;
&lt;td&gt;80000&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alice&lt;/td&gt;
&lt;td&gt;70000&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bob&lt;/td&gt;
&lt;td&gt;70000&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;David&lt;/td&gt;
&lt;td&gt;45000&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;RANK()&lt;/code&gt; skips 3 after the tie. &lt;code&gt;DENSE_RANK()&lt;/code&gt; doesn't skip — it goes straight to 3.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Running Total with SUM() OVER
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;emp_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;running_total&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;salary&lt;/th&gt;
&lt;th&gt;running_total&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Alice&lt;/td&gt;
&lt;td&gt;70000&lt;/td&gt;
&lt;td&gt;70000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bob&lt;/td&gt;
&lt;td&gt;55000&lt;/td&gt;
&lt;td&gt;125000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Carol&lt;/td&gt;
&lt;td&gt;80000&lt;/td&gt;
&lt;td&gt;205000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;David&lt;/td&gt;
&lt;td&gt;45000&lt;/td&gt;
&lt;td&gt;250000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Each row shows the cumulative salary total up to that point.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  LAG() and LEAD() — Compare Row to Its Neighbor
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LAG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;prev_salary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;LEAD&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;next_salary&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;salary&lt;/th&gt;
&lt;th&gt;prev_salary&lt;/th&gt;
&lt;th&gt;next_salary&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;David&lt;/td&gt;
&lt;td&gt;45000&lt;/td&gt;
&lt;td&gt;NULL&lt;/td&gt;
&lt;td&gt;55000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bob&lt;/td&gt;
&lt;td&gt;55000&lt;/td&gt;
&lt;td&gt;45000&lt;/td&gt;
&lt;td&gt;70000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alice&lt;/td&gt;
&lt;td&gt;70000&lt;/td&gt;
&lt;td&gt;55000&lt;/td&gt;
&lt;td&gt;80000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Carol&lt;/td&gt;
&lt;td&gt;80000&lt;/td&gt;
&lt;td&gt;70000&lt;/td&gt;
&lt;td&gt;NULL&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Great for comparing month-over-month changes or spotting trends.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Combining Joins + Window Functions
&lt;/h3&gt;

&lt;p&gt;This is where things get really powerful. Let's find each employee's salary rank within their department name (not just ID):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;RANK&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;PARTITION&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_name&lt;/span&gt; &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;dept_salary_rank&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;INNER&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;departments&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dept_name&lt;/th&gt;
&lt;th&gt;salary&lt;/th&gt;
&lt;th&gt;dept_salary_rank&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Carol&lt;/td&gt;
&lt;td&gt;Engineering&lt;/td&gt;
&lt;td&gt;80000&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alice&lt;/td&gt;
&lt;td&gt;Engineering&lt;/td&gt;
&lt;td&gt;70000&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bob&lt;/td&gt;
&lt;td&gt;Marketing&lt;/td&gt;
&lt;td&gt;55000&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;INNER JOIN&lt;/strong&gt; is your default — use it when you only want rows that match in both tables.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LEFT JOIN&lt;/strong&gt; is great when you want to keep all records from your primary (left) table regardless of matches.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FULL OUTER JOIN&lt;/strong&gt; is ideal for data audits or finding unmatched records on either side.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Window Functions don't reduce your rows&lt;/strong&gt; — they add a computed column while keeping the full dataset visible.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;ROW_NUMBER()&lt;/strong&gt; to pick one row per group (top N queries), &lt;strong&gt;RANK()&lt;/strong&gt; for leaderboards, and &lt;strong&gt;LAG/LEAD()&lt;/strong&gt; for time-series or sequential comparisons.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Combining Joins and Window Functions&lt;/strong&gt; gives you the ability to do complex analytics that would otherwise require multiple subqueries or CTEs.&lt;/li&gt;
&lt;/ol&gt;




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

&lt;p&gt;Joins and Window Functions are two pillars of advanced SQL. Joins bring your data together; window functions help you analyze it with context. Once you're comfortable using both — especially together — you'll find yourself writing cleaner, faster, and more expressive queries.&lt;/p&gt;

&lt;p&gt;Practice with real datasets, experiment with edge cases (like NULLs in join keys), and you'll build an intuition that no amount of reading alone can give you.&lt;/p&gt;

&lt;p&gt;Happy querying! &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>sql</category>
      <category>database</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How Analysts Translate Messy Data, DAX, and Dashboards into Action Using Power BI</title>
      <dc:creator>Jill Nandaha</dc:creator>
      <pubDate>Sat, 07 Feb 2026 14:14:34 +0000</pubDate>
      <link>https://forem.com/nandaha/how-analysts-translate-messy-data-dax-and-dashboards-into-action-using-power-bi-4i9d</link>
      <guid>https://forem.com/nandaha/how-analysts-translate-messy-data-dax-and-dashboards-into-action-using-power-bi-4i9d</guid>
      <description>&lt;p&gt;As a data analyst, you're not just building pretty charts—you're building bridges between raw data chaos and executive decision-making. Power BI is the tool that makes this translation possible, but the real magic happens in understanding how technical skills create tangible business impact.&lt;br&gt;
Let me walk you through how this transformation actually works in practice.&lt;/p&gt;
&lt;h3&gt;
  
  
  The Reality: Data is Never Clean
&lt;/h3&gt;

&lt;p&gt;Every analyst knows the truth: data arrives messy. Sales records have duplicate entries, customer information is scattered across five different systems, dates are formatted inconsistently, and that critical revenue column? It's sometimes stored as text.&lt;br&gt;
This is where Power Query becomes your first line of defense. It's not just about making data "pretty"—it's about making data trustworthy so that business decisions built on top of it don't crumble.&lt;/p&gt;
&lt;h4&gt;
  
  
  Real-World Example: E-Commerce Sales Analysis
&lt;/h4&gt;

&lt;p&gt;Imagine you're analyzing sales for an online retailer. Your data comes from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shopify (sales transactions)&lt;/li&gt;
&lt;li&gt;Google Analytics (traffic sources)&lt;/li&gt;
&lt;li&gt;Email marketing platform (campaign performance)&lt;/li&gt;
&lt;li&gt;Customer service database (returns and complaints)
Each system has different customer identifiers, date formats, and naming conventions. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Without proper data transformation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A customer who bought three times appears as three different people&lt;/li&gt;
&lt;li&gt;Marketing ROI calculations are wildly inaccurate&lt;/li&gt;
&lt;li&gt;Executive dashboards show conflicting revenue numbers
&lt;strong&gt;The Technical Fix:&lt;/strong&gt;
// Power Query M code to standardize customer IDs
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;= Table.TransformColumns(
    Source,
    {{"CustomerEmail", Text.Lower},
     {"PurchaseDate", each Date.From(_)},
     {"Revenue", each Number.From(Text.Replace(_, "$", ""))}}
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;The Business Impact:&lt;/strong&gt; With clean, unified data, the marketing director can now accurately see that email campaigns generate 23% higher customer lifetime value than social media ads—leading to a strategic reallocation of the $500K annual marketing budget.&lt;/p&gt;
&lt;h3&gt;
  
  
  DAX: Where Technical Meets Strategic
&lt;/h3&gt;

&lt;p&gt;DAX (Data Analysis Expressions) is often seen as the intimidating part of Power BI, but it's actually where you translate business questions into measurable answers.&lt;br&gt;
Business leaders don't ask for "calculated columns." They ask questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"What's our customer retention rate compared to last quarter?"&lt;/li&gt;
&lt;li&gt;"Which product categories are growing faster than the market?"&lt;/li&gt;
&lt;li&gt;"How much revenue are we losing to cart abandonment?"
DAX is how you answer these questions with precision.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example: Moving Beyond Basic Metrics&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basic Question:&lt;/strong&gt; "What were our sales last month?"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Last Month Sales = 
CALCULATE(
    SUM(Sales[Revenue]),
    PREVIOUSMONTH(Calendar[Date])
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Strategic Question:&lt;/strong&gt; "Are we growing faster or slower than we did at the same point last year?"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;YoY Growth Rate = 
VAR CurrentYearSales = SUM(Sales[Revenue])
VAR PreviousYearSales = 
    CALCULATE(
        SUM(Sales[Revenue]),
        SAMEPERIODLASTYEAR(Calendar[Date])
    )
RETURN
    DIVIDE(
        CurrentYearSales - PreviousYearSales,
        PreviousYearSales,
        0
    )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second measure doesn't just report numbers—it answers whether the business is accelerating or decelerating. This single metric has driven decisions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Whether to hire 10 new sales reps (cost: $800K/year)&lt;/li&gt;
&lt;li&gt;Whether to expand into a new geographic market&lt;/li&gt;
&lt;li&gt;Whether investors should be concerned about growth trajectory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Time Intelligence: The Hidden Powerhouse&lt;/strong&gt;&lt;br&gt;
One of DAX's superpowers is time intelligence. Business operates in time—quarterly targets, seasonal trends, year-over-year comparisons—and DAX makes temporal analysis intuitive:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rolling 12-Month Average = 
CALCULATE(
    AVERAGE(Sales[Revenue]),
    DATESINPERIOD(
        Calendar[Date],
        LASTDATE(Calendar[Date]),
        -12,
        MONTH
    )
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This measure smooths out seasonal volatility, helping executives see the true trend line beneath the noise. When a retail chain used this to analyze store performance, they discovered that three "underperforming" stores were actually on strong growth trajectories—they were just in seasonal markets. This saved those stores from closure.&lt;/p&gt;

&lt;h4&gt;
  
  
  Dashboards: The Translation Layer
&lt;/h4&gt;

&lt;p&gt;A dashboard is not a data dump. It's a conversation between the analyst and the decision-maker, designed around specific questions and actions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bad Dashboard Design&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;47 different metrics crammed onto one page&lt;/li&gt;
&lt;li&gt;No clear hierarchy of information&lt;/li&gt;
&lt;li&gt;Requires a PhD in statistics to interpret&lt;/li&gt;
&lt;li&gt;No connection to actual business decisions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Good Dashboard Design&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Organized around decision-making frameworks:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Executive Dashboard: "Should I be worried?"&lt;/strong&gt;&lt;br&gt;
Revenue vs. target (red/green indicator)&lt;br&gt;
Top 3 growing opportunities&lt;br&gt;
Top 3 risks requiring attention&lt;br&gt;
One-click drill-down to details&lt;br&gt;
&lt;strong&gt;2. Operational Dashboard: "What needs my attention today?"&lt;/strong&gt;&lt;br&gt;
Orders pending fulfillment&lt;br&gt;
Inventory below reorder point&lt;br&gt;
Customer service tickets over SLA&lt;br&gt;
Real-time alerts for anomalies&lt;br&gt;
&lt;strong&gt;3. Analytical Dashboard: "Why is this happening?"&lt;/strong&gt;&lt;br&gt;
Cohort analysis showing customer behavior patterns&lt;br&gt;
Correlation between marketing spend and customer acquisition&lt;br&gt;
Geographic breakdown of performance&lt;br&gt;
Time-based trend analysis&lt;/p&gt;

&lt;h4&gt;
  
  
  Case Study: Reducing Decision-Making Time
&lt;/h4&gt;

&lt;p&gt;A SaaS company was struggling with churn. Their executives spent hours each week in meetings trying to understand which customers were at risk.&lt;br&gt;
&lt;strong&gt;The Power BI Solution:&lt;/strong&gt;&lt;br&gt;
Created a customer health score combining product usage, support tickets, and payment history&lt;br&gt;
Built automated alerts when health scores dropped below thresholds&lt;br&gt;
Designed a drill-down dashboard showing exactly which features at-risk customers weren't using&lt;br&gt;
&lt;strong&gt;The Impact:&lt;/strong&gt;&lt;br&gt;
Customer success team response time: reduced from 2 weeks to 24 hours&lt;br&gt;
Churn rate: decreased by 18% in six months&lt;br&gt;
Executive meeting time on churn: reduced from 6 hours/week to 30 minutes/week&lt;br&gt;
Annual revenue retained: $2.3M&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffczb3pglschi0kokn8k1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffczb3pglschi0kokn8k1.png" alt="Skill Translation Matrix" width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  From Dashboards to Decisions: Closing the Loop
&lt;/h4&gt;

&lt;p&gt;The most sophisticated Power BI implementation means nothing if it doesn't drive action. Here's how to ensure your work creates impact:&lt;br&gt;
&lt;strong&gt;1. Start with the Decision, Not the Data&lt;/strong&gt;&lt;br&gt;
Before opening Power BI, ask:&lt;br&gt;
What decision will be made with this information?&lt;br&gt;
Who needs to make it?&lt;br&gt;
What will they do differently based on what they see?&lt;br&gt;
&lt;strong&gt;2. Design for Action&lt;/strong&gt;&lt;br&gt;
Every dashboard should have:&lt;br&gt;
Clear "what's wrong" or "what's working" signals&lt;br&gt;
Obvious next steps&lt;br&gt;
Accountability (who owns this metric?)&lt;br&gt;
&lt;strong&gt;3. Establish Feedback Loops&lt;/strong&gt;&lt;br&gt;
Track:&lt;br&gt;
How many decisions were influenced by your dashboards?&lt;br&gt;
What actions were taken?&lt;br&gt;
What was the outcome?&lt;br&gt;
This creates a virtuous cycle where your technical skills are continuously refined based on real business impact.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common Pitfalls to Avoid
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Over-Engineering:&lt;/strong&gt; Building elaborate DAX calculations that answer questions no one is asking. Always validate that complexity adds business value.&lt;br&gt;
&lt;strong&gt;The "Everything Dashboard":&lt;/strong&gt; Trying to serve every stakeholder with one massive dashboard. Different roles need different views.&lt;br&gt;
&lt;strong&gt;Ignoring Performance:&lt;/strong&gt; A dashboard that takes 2 minutes to load won't get used. Technical optimization (aggregations, DirectQuery vs. Import mode, efficient DAX) directly impacts adoption.&lt;br&gt;
&lt;strong&gt;Static Insights:&lt;/strong&gt; Building dashboards that report what happened but don't predict what's coming or prescribe what to do about it.&lt;/p&gt;

&lt;h5&gt;
  
  
  The Future-Ready Analyst
&lt;/h5&gt;

&lt;p&gt;The analysts who create the most business impact with Power BI aren't just technically proficient—they're bilingual. They speak both the language of data (M code, DAX, data modeling) and the language of business (ROI, market share, customer lifetime value).&lt;br&gt;
They understand that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clean data transformation prevents million-dollar mistakes&lt;/li&gt;
&lt;li&gt;Clever DAX measures answer strategic questions&lt;/li&gt;
&lt;li&gt;Well-designed dashboards compress decision-making time from days   to minutes
The ultimate measure of success isn't dashboard views—it's better business outcomes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Power BI is powerful not because it makes pretty visualizations, but because it creates a systematic way to translate messy reality into clear action. As an analyst, your job is to build the bridge between data chaos and executive clarity.&lt;br&gt;
Master Power Query to make data trustworthy. Use DAX to answer strategic questions. Design dashboards that drive decisions. And always, always close the loop by measuring whether your technical work created real business impact.&lt;br&gt;
That's how you transform from someone who "makes reports" into someone who drives business outcomes. And that's the difference between being a technician and being a strategic asset to your organization.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What's your experience translating Power BI skills into business impact? Share your stories in the comments below!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>analytics</category>
      <category>storytelling</category>
      <category>data</category>
    </item>
    <item>
      <title>The Blueprint of Insight: Data Modeling in Power BI</title>
      <dc:creator>Jill Nandaha</dc:creator>
      <pubDate>Mon, 02 Feb 2026 07:17:47 +0000</pubDate>
      <link>https://forem.com/nandaha/the-blueprint-of-insight-data-modeling-in-power-bi-ip6</link>
      <guid>https://forem.com/nandaha/the-blueprint-of-insight-data-modeling-in-power-bi-ip6</guid>
      <description>&lt;p&gt;In the world of Power BI, many users rush straight to the "Report" view to drag and drop visuals. However, the real magic—and the source of most headaches—happens in the Model view. Data modeling is the process of defining how your data connects, ensuring that your reports are fast, accurate, and easy to maintain.&lt;br&gt;
A well-structured data model allows Power BI to efficiently process complex analytical queries and generate insightful visualizations. Conversely, poor modeling can lead to slow visuals, inconsistent results, and significant maintenance overhead, hindering data-driven decision-making&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The Building Blocks: Fact and Dimension Tables
&lt;/h2&gt;

&lt;p&gt;Before choosing a schema, you must categorize your data into two distinct types of tables.&lt;br&gt;
&lt;strong&gt;Fact Tables:&lt;/strong&gt; These contain the quantitative data—the "numbers" you want to aggregate. Think of sales amounts, temperatures, or transaction counts. They are usually long, skinny, and contain foreign keys to link to other tables.&lt;br&gt;
&lt;strong&gt;Dimension Tables:&lt;/strong&gt; These provide the context—the "who, what, where, and when." Common dimensions include Date, Product, Customer, and Geography.&lt;/p&gt;

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

&lt;p&gt;The Star Schema is the highly recommended modeling approach for Power BI. In this setup, a central fact table is surrounded by several dimension tables.&lt;br&gt;
&lt;em&gt;How it works:&lt;/em&gt; Each dimension table connects directly to the fact table.&lt;br&gt;
&lt;em&gt;Pros:&lt;/em&gt; It is simple for the Power BI engine (VertiPaq) to process, leads to faster DAX calculations, and is intuitive for users to navigate.&lt;br&gt;
&lt;em&gt;Cons:&lt;/em&gt; It may require "denormalizing" your data (combining multiple tables into one) during the Power Query phase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fact Table:&lt;/strong&gt; The fact table is the core of the star schema, containing quantitative measurements or "facts" (e.g., sales amount, order quantity, temperature readings, sensor data) and foreign keys that link to the dimension tables. Each row in a fact table represents a single event or measurement, defined at the most atomic level possible, known as its "grain". For instance, in a hospital laboratory, the grain might be a single atomic observation result from a specific specimen at a particular instant . This meticulous definition of grain is critical for the model's analytical power. In Power BI, fact tables should primarily contain additive numeric measures and foreign keys, optimizing for calculations and aggregations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dimension Tables:&lt;/strong&gt; Dimension tables provide descriptive context to the facts in the fact table. They contain textual or descriptive attributes (e.g., product names, customer demographics, dates, locations) that allow for "slicing and dicing" data for analysis. Unlike highly normalized tables in OLTP systems, dimension tables in a star schema are intentionally denormalized, meaning they are wider and flatter, containing all relevant attributes for a given entity in one row. This denormalization makes querying incredibly fast because it reduces the need for multiple joins, trading some storage redundancy for significant gains in analytical speed. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdl8w4xmn16gaese2iwdg.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdl8w4xmn16gaese2iwdg.webp" alt="Star Schema" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The Complex Cousin: Snowflake Schema
&lt;/h2&gt;

&lt;p&gt;A Snowflake Schema occurs when dimension tables are "normalized"—broken down into further sub-dimension tables. For example, instead of a single Product table, you have a Product table that links to a Sub-Category table, which then links to a Category table.&lt;br&gt;
&lt;em&gt;Why use it?&lt;/em&gt; It saves storage space in traditional SQL databases by reducing redundancy.&lt;br&gt;
&lt;strong&gt;The Power BI Reality:&lt;/strong&gt; While it looks organized, it often slows down performance in Power BI because the engine has to "hop" through more relationships to filter the fact table.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Normalization:&lt;/strong&gt; The primary advantage of the snowflake schema is reduced data redundancy, as common attributes are stored only once in their respective sub-dimension tables. This can simplify the maintenance of hierarchies, as changes to a category name, for instance, only need to be updated in one place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Query Complexity and Performance:&lt;/strong&gt; While offering reduced redundancy, the snowflake schema introduces increased query complexity due to the additional joins required to retrieve descriptive attributes. In Power BI, which utilizes a columnar in-memory engine (VertiPaq) that favors flattened, denormalized structures, excessive normalization in a snowflake schema can lead to degraded performance . Although the performance impact of extra joins might be negligible for smaller dimension tables in many clinical applications, it is a critical trade-off to consider.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdcdcyqdamk53ecuoekc4.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdcdcyqdamk53ecuoekc4.webp" alt="Snowflake schema" width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Defining Relationships
&lt;/h2&gt;

&lt;p&gt;Relationships are the pathways through which filters flow. In Power BI, you need to be mindful of two settings:&lt;br&gt;
The establishment of correct relationships between tables is paramount in Power BI. These relationships define how tables interact and how filters propagate through the data model .&lt;/p&gt;

&lt;p&gt;Relationships are typically defined by &lt;strong&gt;cardinality&lt;/strong&gt;, such as one-to-many (1:N), many-to-one (N:1), one-to-one (1:1), or many-to-many (N:N) . In dimensional modeling, the most common relationship is between a single dimension table row and multiple fact table rows (1:N or N:1) .&lt;br&gt;
&lt;strong&gt;Directionality:&lt;/strong&gt; Relationships also have directionality (single or bidirectional). Incorrect relationship settings can lead to ambiguous filter contexts, inaccurate aggregations, and circular dependency errors, making the data model unreliable .&lt;br&gt;
&lt;strong&gt;Bridge Tables:&lt;/strong&gt; For many-to-many relationships, which are inherently complex and can cause issues in Power BI, the use of bridge tables is often recommended to resolve these complexities and maintain model integrity .&lt;/p&gt;

&lt;h2&gt;
  
  
  5. The Importance of Good Data Modeling for Performance and Accurate Reporting
&lt;/h2&gt;

&lt;p&gt;Good data modeling in Power BI directly translates into enhanced performance and reliable reporting, which are crucial for business intelligence .&lt;br&gt;
&lt;strong&gt;Query Efficiency:&lt;/strong&gt; Star schemas, by denormalizing dimensions, significantly reduce the number of joins required for analytical queries, leading to faster data retrieval and report loading times . Power BI's analytical engine thrives on this structure, quickly processing large volumes of data .&lt;br&gt;
&lt;strong&gt;Data Compression:&lt;/strong&gt; A well-designed model optimizes data compression within Power BI's in-memory engine, further accelerating query performance .&lt;br&gt;
&lt;strong&gt;Intuitive DAX Calculations:&lt;/strong&gt; Data Analysis Expressions (DAX) are crucial for creating custom calculations and measures in Power BI . A clean, logical data model simplifies the writing of DAX formulas and ensures their correct evaluation, preventing inconsistent totals and errors in complex analyses .&lt;br&gt;
&lt;strong&gt;Filter Propagation:&lt;/strong&gt; Proper relationships ensure that filters applied in reports accurately propagate across tables, providing consistent and correct aggregations and drill-down capabilities .&lt;br&gt;
&lt;strong&gt;Time Intelligence:&lt;/strong&gt; Accurate time intelligence functions (e.g., year-to-date, month-over-month comparisons) rely on correctly structured and marked date dimension tables, which are a hallmark of good dimensional modeling .&lt;br&gt;
&lt;strong&gt;Scalability and Maintenance:&lt;/strong&gt; A robust data model is scalable, accommodating growing data volumes and evolving business requirements without significant overhauls . It also simplifies maintenance, as changes can be implemented predictably without breaking existing reports .&lt;br&gt;
&lt;strong&gt;Foundation for Advanced Analytics:&lt;/strong&gt; The organized and consistent data provided by a well-designed data model serves as a stable foundation for advanced analytical techniques, including machine learning models and predictive analytics, enabling richer insights .&lt;/p&gt;

&lt;p&gt;In essence, the choice and implementation of a data model, particularly adherence to dimensional modeling principles like the star schema, are critical success factors for any Power BI implementation . It underpins the ability of organizations to transform raw data into actionable intelligence, driving strategic decision-making and competitive advantage . The process involves extracting, transforming, and loading (ETL) data from various sources into the warehouse, ensuring data quality and consistency before analysis . This systematic approach supports not only business reporting but also scientific discovery and operational management across diverse fields.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; When in doubt, "denormalize." It is almost always better to have one wide Product table than three separate tables for Category, Sub-category, and Item.&lt;/p&gt;

</description>
      <category>data</category>
      <category>powerfuldevs</category>
      <category>schema</category>
    </item>
    <item>
      <title>Introduction to MS Excel for Data Analytics</title>
      <dc:creator>Jill Nandaha</dc:creator>
      <pubDate>Sun, 25 Jan 2026 18:51:52 +0000</pubDate>
      <link>https://forem.com/nandaha/introduction-to-ms-excel-for-data-analytics-3gjm</link>
      <guid>https://forem.com/nandaha/introduction-to-ms-excel-for-data-analytics-3gjm</guid>
      <description>&lt;p&gt;When people hear data analytics, they often think of complex tools, programming languages, or intimidating dashboards. In reality, many data analysis tasks start with a tool most of us already have: Microsoft Excel.&lt;br&gt;
Excel is one of the most powerful and accessible tools for basic data analysis, especially for beginners. In this article, we’ll explore how Excel can be used to analyze data, uncover patterns, and support decision-making—without writing a single line of code.&lt;/p&gt;

&lt;p&gt;Why Use Excel for Data Analytics?&lt;br&gt;
Microsoft Excel is widely used because it is:&lt;br&gt;
• Easy to learn and beginner-friendly&lt;br&gt;
• Available in most workplaces and schools&lt;br&gt;
• Powerful enough for basic to intermediate analysis&lt;br&gt;
• Excellent for exploring and understanding raw data&lt;br&gt;
For anyone starting out in data analytics, Excel helps build foundational skills such as data cleaning, summarization, and visualization.&lt;/p&gt;

&lt;p&gt;Understanding Data in Excel&lt;br&gt;
In Excel, data is organized in rows and columns:&lt;br&gt;
• Rows represent individual records (e.g., a sale, a customer, or a transaction)&lt;br&gt;
• Columns represent attributes (e.g., date, product name, quantity, revenue)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fackq6u1gg1b8l0m31ibs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fackq6u1gg1b8l0m31ibs.png" alt=" " width="550" height="304"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before analyzing data, it’s important to ensure:&lt;br&gt;
• Each column has a clear header&lt;br&gt;
• There are no empty rows in the middle of the dataset&lt;br&gt;
• Data types are consistent (numbers as numbers, dates as dates)&lt;/p&gt;

&lt;p&gt;Sorting and Filtering Data&lt;br&gt;
Sorting Data&lt;br&gt;
Sorting allows you to arrange data in ascending or descending order.&lt;br&gt;
Examples:&lt;br&gt;
• Sort sales by highest revenue&lt;br&gt;
• Sort dates from oldest to newest&lt;br&gt;
Steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Select the dataset&lt;/li&gt;
&lt;li&gt; Go to Data → Sort&lt;/li&gt;
&lt;li&gt; Choose the column and order&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdzc0g49vzoibvl4o805z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdzc0g49vzoibvl4o805z.png" alt=" " width="360" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Filtering Data&lt;br&gt;
Filtering helps you focus on specific data points.&lt;br&gt;
Examples:&lt;br&gt;
• Show sales for only one product&lt;br&gt;
• Filter transactions from a specific month&lt;br&gt;
Steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Select the header row&lt;/li&gt;
&lt;li&gt; Click Data → Filter&lt;/li&gt;
&lt;li&gt; Use the dropdown arrows to apply conditions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdlqikfylz6bcjczcpz54.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdlqikfylz6bcjczcpz54.png" alt=" " width="502" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using Basic Excel Functions for Analysis&lt;br&gt;
Excel functions help perform calculations automatically.&lt;br&gt;
Commonly Used Functions&lt;br&gt;
• SUM() – Adds values&lt;br&gt;
• AVERAGE() – Calculates the mean&lt;br&gt;
• COUNT() / COUNTA() – Counts values&lt;br&gt;
• MIN() / MAX() – Finds smallest or largest values&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;=SUM(C2:C20)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Creating Pivot Tables&lt;br&gt;
Pivot Tables are one of Excel’s most powerful data analysis features.&lt;br&gt;
They allow you to:&lt;br&gt;
• Summarize large datasets&lt;br&gt;
• Group data by category&lt;br&gt;
• Calculate totals, averages, and counts&lt;br&gt;
How to Create a Pivot Table&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Select your dataset&lt;/li&gt;
&lt;li&gt; Go to Insert → PivotTable&lt;/li&gt;
&lt;li&gt; Choose where to place it&lt;/li&gt;
&lt;li&gt; Drag fields into Rows, Columns, and Values&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Data Visualization with Charts&lt;br&gt;
Charts help turn numbers into insights that are easy to understand.&lt;br&gt;
Common Excel charts for data analysis include:&lt;br&gt;
• Column charts&lt;br&gt;
• Bar charts&lt;br&gt;
• Line charts&lt;br&gt;
• Pie charts&lt;br&gt;
Steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Select the summarized data&lt;/li&gt;
&lt;li&gt; Go to Insert → Charts&lt;/li&gt;
&lt;li&gt; Choose a chart type&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdd9q22fc3qh9jhkqtoke.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdd9q22fc3qh9jhkqtoke.png" alt=" " width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Basic Data Cleaning in Excel&lt;br&gt;
Real-world data is often messy. Excel provides simple tools for cleaning data:&lt;br&gt;
• Remove Duplicates:&lt;br&gt;
Data → Remove Duplicates&lt;br&gt;
• Text to Columns:&lt;br&gt;
Split combined data into separate columns&lt;br&gt;
• Find and Replace:&lt;br&gt;
Fix inconsistent naming or formatting&lt;/p&gt;

&lt;p&gt;Limitations of Excel&lt;br&gt;
While Excel is powerful, it does have limitations:&lt;br&gt;
• Not ideal for very large datasets&lt;br&gt;
• Manual processes can lead to errors&lt;br&gt;
• Limited automation compared to advanced tools&lt;br&gt;
However, for beginners and small to medium datasets, Excel is more than sufficient.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
Microsoft Excel is an excellent starting point for anyone interested in data analytics. It allows users to clean data, perform calculations, summarize information, and create visualizations—all within a familiar interface.&lt;br&gt;
Mastering Excel builds a strong foundation for learning advanced tools like SQL, Python, Power BI, or Tableau. In many cases, meaningful insights can be discovered using Excel alone.&lt;br&gt;
If you’re starting your data analytics journey, Excel is not just a tool—it’s a skill worth mastering.&lt;/p&gt;

</description>
      <category>analytics</category>
      <category>pivot</category>
    </item>
    <item>
      <title>An Introduction to Git &amp; Gitbash</title>
      <dc:creator>Jill Nandaha</dc:creator>
      <pubDate>Wed, 14 Jan 2026 16:11:51 +0000</pubDate>
      <link>https://forem.com/nandaha/an-introduction-to-git-gitbash-5emm</link>
      <guid>https://forem.com/nandaha/an-introduction-to-git-gitbash-5emm</guid>
      <description>&lt;h2&gt;
  
  
  What Is Git?
&lt;/h2&gt;

&lt;p&gt;Git is an open-source version control system which means that it records files over a period of time and these changes can be recalled at a later date. You can do a lot with Git whether it can be branching (creating something that is different from the master branch (the one you would most likely be working on)) or just committing to a repository (programming jargon simply calls it a repo).&lt;/p&gt;

&lt;h5&gt;
  
  
  Basic Setup
&lt;/h5&gt;

&lt;p&gt;Depending on what OS (operating system) you have the setup might be slightly different.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Linux :&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;sudo apt update&lt;/code&gt; This will essentially update your system.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt install git&lt;/code&gt; This will install Git on the system.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git --version&lt;/code&gt; This is used to verify its downloaded.&lt;/p&gt;

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

&lt;h4&gt;
  
  
  Navigate to Git-SCM: Git SCM Download
&lt;/h4&gt;

&lt;p&gt;Git SCM will download protocol but also a BASH, a command line&lt;/p&gt;

&lt;p&gt;Basic/ Most Used Bash Commands &lt;br&gt;
&lt;code&gt;ls&lt;/code&gt; - lists the folders and files in the working directory (the current directory you are in)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd&lt;/code&gt; - changes directory&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pwd&lt;/code&gt;- used to find the path for the current directory&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mkdir&lt;/code&gt;- make a directory&lt;/p&gt;

&lt;p&gt;&lt;code&gt;touch&lt;/code&gt; - update the access and or modification date of a file or directory without opening, saving or closing the file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cat&lt;/code&gt; - print files to stdout&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mv&lt;/code&gt; - moves files and folders&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cp&lt;/code&gt; - copies files or folders&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rm&lt;/code&gt; - remove files and folder (look into modifiers for this one)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;chmod&lt;/code&gt; - Change mode so you can set permissions for read, write and execute for the user, members of your group and others. (Binary can be used for this)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;man&lt;/code&gt; - can be used to look up any commands ie &lt;code&gt;man cd&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using GitBash/Terminal to Access GitHub&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Configure Git via &lt;code&gt;git config --global user.name "[name]"&lt;/code&gt; and &lt;code&gt;git config --global user.email "[email address]"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Navigate to your working directory &lt;br&gt;
Initialize a Git Repo via &lt;code&gt;git init&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, this is where you can branch-of, you have two options, -------pushing a new repo or pushing a preexistent repo.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pushing a New Repo&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Commit your repo via &lt;code&gt;git commit -m "first commit"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Remote add your repo via git &lt;code&gt;remote add origin &amp;lt;url&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Push to your repo via &lt;code&gt;git push -u origin master&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;For Pushing an Existing Repo&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Remote add your repo via &lt;code&gt;git remote add origin &amp;lt;url&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Push to your repo via &lt;code&gt;git push -u origin master&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now that you have your repo set up, these are some helpful commands:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git status&lt;/code&gt; Used to check what has changed ie additions and deletions&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git add &amp;lt;file&amp;gt;&lt;/code&gt; Used to add files to commit if used with a period (.) it adds all of the files&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git commit -m "message"&lt;/code&gt; Use to commit changed, but it is on the local system, the -m can be changed to things such as -u which is an update but it is recommended to keep with an -m&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git push&lt;/code&gt; Used to push changes to GitHub&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git reset&lt;/code&gt; Can be used after commit to reset the commits (Good if you accidentally add a file you did not want)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git pull &amp;lt;url&amp;gt;&lt;/code&gt; Can be used to pull from any git repo, leave the URL out if your updating your current repo&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;.gitignore&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;.gitignore&lt;/code&gt; file is useful for stopping certain files from committing automatically. It should automatically be in a repo when you create a project. To use it just cd to the directory where the file you want to exclude is and use &lt;code&gt;pwd&lt;/code&gt; to find the directory pathing. Then copy the path into the file, it should look like a text file, and then add the name of the file you want to exclude.&lt;/p&gt;

&lt;p&gt;Example: &lt;em&gt;User/Jill/Programming/src/JillNandaha&lt;/em&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Branching in Git
&lt;/h5&gt;

&lt;p&gt;Branching is useful when many people are working on the same project or when you have multiple versions of the same project. The major advantage of branching is when you want to add a feature without compromising the integrity of the master branch.&lt;/p&gt;

&lt;h6&gt;
  
  
  Branching Commands
&lt;/h6&gt;

&lt;p&gt;&lt;code&gt;git branch [branch-name]&lt;/code&gt; Used to create a new branch&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git checkout [branch-name]&lt;/code&gt; Used to switch branches&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git merge [branch]&lt;/code&gt; Used to merge branch commits &lt;br&gt;
&lt;code&gt;git branch -d [branch-name]&lt;/code&gt; Used to delete a branch&lt;/p&gt;

&lt;p&gt;The relevance of Git Bash extends beyond version control, as it plays a critical role in standardizing development environments and enhancing developer productivity. By providing a consistent command-line interface, Git Bash allows scripts, build processes, and automation tasks to be executed uniformly across different operating systems. Proficiency in Git Bash strengthens a developer’s understanding of system-level operations and prepares them for working with advanced tools such as Docker, CI/CD pipelines, and remote servers that rely heavily on Unix-based command-line interactions.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>cli</category>
      <category>git</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
