<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: rose odiwuor</title>
    <description>The latest articles on DEV Community by rose odiwuor (@rose_odiwuor).</description>
    <link>https://dev.to/rose_odiwuor</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3951249%2F3d6194b0-29cd-46db-88a7-ccf9caba41f5.png</url>
      <title>DEV Community: rose odiwuor</title>
      <link>https://dev.to/rose_odiwuor</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rose_odiwuor"/>
    <language>en</language>
    <item>
      <title>The SQL Time Machine: How to use LAG(), LEAD(), FIRST_VALUE() &amp; LAST_VALUE() to analyse business performance</title>
      <dc:creator>rose odiwuor</dc:creator>
      <pubDate>Mon, 17 Aug 2026 21:35:22 +0000</pubDate>
      <link>https://dev.to/rose_odiwuor/the-sql-time-machine-how-to-use-lag-lead-firstvalue-lastvalue-to-analyse-business-3942</link>
      <guid>https://dev.to/rose_odiwuor/the-sql-time-machine-how-to-use-lag-lead-firstvalue-lastvalue-to-analyse-business-3942</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;SQL &lt;strong&gt;window functions&lt;/strong&gt; perform calculations across a set of rows related to the current row, without collapsing results into a single aggregated row. They are defined using the &lt;strong&gt;&lt;em&gt;OVER()&lt;/em&gt;&lt;/strong&gt; clause, which can include &lt;strong&gt;&lt;em&gt;PARTITION BY&lt;/em&gt;&lt;/strong&gt; (to group rows) and &lt;strong&gt;&lt;em&gt;ORDER BY&lt;/em&gt;&lt;/strong&gt; (to define row order within each group).&lt;/p&gt;

&lt;p&gt;Basic Syntax:&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;column_name1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;window_function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;column_name2&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;column_name3&lt;/span&gt;&lt;span class="p"&gt;]&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;column_name4&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;new_column&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="k"&gt;table_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Unlike standard aggregates, window functions retain individual rows while adding calculated values such as rankings, running totals, or moving averages.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&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;driver_id&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;fare&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="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="k"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fare&lt;/span&gt;&lt;span class="p"&gt;)&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;revenue_rank&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;safari&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;trips&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;driver_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;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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2stk8sv0ddooa8v63jzd.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2stk8sv0ddooa8v63jzd.png" alt=" " width="577" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have 3 categories of window functions in SQL.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Aggregate Functions&lt;/em&gt;&lt;/strong&gt;: COUNT(), SUM(), AVG(), MIN(), MAX()&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Rank Functions&lt;/em&gt;&lt;/strong&gt;: ROW_NUMBER(), RANK(), DENSE_RANK(), PERCENT_RANK(),NTILE()&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Value Window Functions&lt;/em&gt;&lt;/strong&gt;: LEAD(), LAG(), FIRST_VALUE(), LAST_VALUE()&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The main focus will be on the last category - Value Window Functions, and how we incorporate them to answer key business questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Main Purpose of Value Functions
&lt;/h2&gt;

&lt;p&gt;They enable us access a value from another row in order to do a comparison, without having to join tables or do self joins. &lt;br&gt;
&lt;strong&gt;&lt;em&gt;i.e&lt;/em&gt;&lt;/strong&gt; compare current row values with values of the previous, next, first and last rows.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4d34t0brr0zeqmvj60tv.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4d34t0brr0zeqmvj60tv.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  1. LAG()
&lt;/h4&gt;

&lt;p&gt;Used to access a value from the previous row within a window/ checks the previous value&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;lag&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fare&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;driver_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;trip_date&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;previous_fare&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;returns the fare from the previous trip the driver took.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  2. LEAD()
&lt;/h4&gt;

&lt;p&gt;Used to access a value from the next row within a window/ checks the next value&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;lead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&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="mi"&gt;0&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="k"&gt;month&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;returns the sales value 2 months from the current row value.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;sales -&amp;gt; expression&lt;br&gt;
2 -&amp;gt; offset; get the value of sales two months ahead&lt;br&gt;
0 -&amp;gt; default; if there's no corresponding value, return 0 instead of null&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If there is no previous/next value we get a &lt;strong&gt;NULL&lt;/strong&gt; for that row.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4&gt;
  
  
  3. FIRST_VALUE()
&lt;/h4&gt;

&lt;p&gt;Returns a value from the first row within a window&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;first_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fare&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;driver_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;trip_date&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;first_fare&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;returns the first ever fare recorded by the driver&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  4. LAST_VALUE()
&lt;/h4&gt;

&lt;p&gt;Returns a value from the last row within a window&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;last_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fare&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;driver_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;trip_date&lt;/span&gt; 
&lt;span class="k"&gt;rows&lt;/span&gt; &lt;span class="k"&gt;between&lt;/span&gt; &lt;span class="k"&gt;current&lt;/span&gt; &lt;span class="k"&gt;row&lt;/span&gt; &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;unbounded&lt;/span&gt; &lt;span class="k"&gt;following&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;last_fare&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;returns the last fare from the driver&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Syntax
&lt;/h3&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnibddowj9ifkve7jucwf.JPG" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnibddowj9ifkve7jucwf.JPG" alt=" " width="799" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All the 4 functions accept all data types i.e integer, text, float etc&lt;/li&gt;
&lt;li&gt;Partition clause is optional&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Frame clause is not allowed for LAG() &amp;amp; LEAD(), optional for FIRST_VALUE() and required for LAST_VALUE().&lt;br&gt;
Frame clause is especially important in LAST_VALUE() to get the correct results.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Default frame in FIRST_VALUE &amp;amp; LAST_VALUE is "&lt;code&gt;range between unbounded preceding and current row&lt;/code&gt;" which works for FIRST_VALUE but not LAST_VALUE, hence the need to define its frame.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Here's how Value Functions help answer real business questions
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;u&gt;Time Series Analysis &lt;/u&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Analyze data to understand patterns, trends and behavior over time.
e.g YoY, MoM sales performance.&lt;/li&gt;
&lt;li&gt;The value functions will help analyze overall growth/decline of the business performance over time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sample business question:&lt;br&gt;
&lt;em&gt;How is revenue changing month by month? What are our best and worst months?&lt;/em&gt;&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;with&lt;/span&gt; &lt;span class="n"&gt;monthly_revenue&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;select&lt;/span&gt;
    &lt;span class="n"&gt;travel_month&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;total_fare&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;safari_connect&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;v_clean_trips&lt;/span&gt;
    &lt;span class="k"&gt;group&lt;/span&gt; &lt;span class="k"&gt;by&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;select&lt;/span&gt;
    &lt;span class="n"&gt;travel_month&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;total_revenue&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;total_revenue&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;travel_month&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_month_revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;total_revenue&lt;/span&gt; &lt;span class="o"&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;total_revenue&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;travel_month&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;mom_rev_change&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;round&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="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total_revenue&lt;/span&gt; &lt;span class="o"&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;total_revenue&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;travel_month&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="o"&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;total_revenue&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;travel_month&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="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;mom_pct_change&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;monthly_revenue&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;travel_month&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result &amp;gt;&amp;gt;&amp;gt;&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5gwpufvhssc8zq40zpcm.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5gwpufvhssc8zq40zpcm.png" alt=" " width="800" height="222"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The best month, using the month-on-month percentage change, is September 2024 and the worst month is January 2025.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  &lt;u&gt;Customer retention analysis &lt;/u&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Measure a customer's behaviour &amp;amp; loyalty to help businesses build strong relationships with customers&lt;/li&gt;
&lt;li&gt;Here we can understand customer's behaviour and loyalty by knowing how long it takes for each customer to buy/place their next order using &lt;strong&gt;lead()&lt;/strong&gt;, and how it changes from one period to another.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;u&gt;Employee / Workforce Analysis &lt;/u&gt;
&lt;/h4&gt;

&lt;p&gt;We could analyze metrics such as;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Employee salary changes over time, using &lt;code&gt;LAG()&lt;/code&gt; - compare an employee's current salary with previous salary.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Salary at next review, using &lt;code&gt;LEAD()&lt;/code&gt; - compare current salary with employee's upcoming salary. &lt;br&gt;
This would help with staff costs planning and budgeting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Performance changes, using &lt;code&gt;FIRST_VALUE()&lt;/code&gt; - compare an employee's current rating/KPI/sales with their starting value.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Value window functions are more than just SQL techniques for moving between rows, they provide a way to gain insights on change and performance within data. &lt;br&gt;
Once you understand how to look back, look ahead and compare values within a window, you can use these functions to answer business questions that go beyond "&lt;strong&gt;What happened?&lt;/strong&gt;" to "&lt;strong&gt;Where were we&lt;/strong&gt;, &lt;strong&gt;where are we going&lt;/strong&gt;, &lt;strong&gt;where did we start&lt;/strong&gt; and &lt;strong&gt;where did we end&lt;/strong&gt;?"&lt;/p&gt;

</description>
      <category>sql</category>
      <category>postgres</category>
      <category>analytics</category>
    </item>
    <item>
      <title>Connecting Power BI to Local and Cloud-based PostgreSQL</title>
      <dc:creator>rose odiwuor</dc:creator>
      <pubDate>Sat, 11 Jul 2026 09:43:16 +0000</pubDate>
      <link>https://dev.to/rose_odiwuor/connecting-power-bi-to-local-and-cloud-based-postgresql-39nn</link>
      <guid>https://dev.to/rose_odiwuor/connecting-power-bi-to-local-and-cloud-based-postgresql-39nn</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Power Bi&lt;/strong&gt; is a data visualization tool that transforms raw data into meaningful and interactive insights, whereas &lt;strong&gt;PostgreSQL&lt;/strong&gt; is a database management system that uses the SQL(structured query language) to store and interact with data from the databases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Local PostgreSQL&lt;/em&gt;&lt;/strong&gt; means that the database is hosted locally on my computer while a &lt;strong&gt;&lt;em&gt;cloud-based&lt;/em&gt;&lt;/strong&gt; stores the databases on cloud data platforms.&lt;/p&gt;

&lt;p&gt;We therefore connect Power BI to PostgreSQL so that data from the databases can be analyzed, visualized and turned into meaningful reports and dashboards.&lt;br&gt;
Instead of exporting data every day, Power BI retrieves the data directly from the database, saving time and reducing errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connection Process
&lt;/h2&gt;

&lt;p&gt;For a local host, download and install &lt;a href="https://www.postgresql.org/download/" rel="noopener noreferrer"&gt;PostgreSQL&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For the cloud based;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;create an account in &lt;a href="https://aiven.io/" rel="noopener noreferrer"&gt;Aiven&lt;/a&gt; - which is a Database-as-a-Service platform&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;download and install &lt;a href="https://dbeaver.io/download/" rel="noopener noreferrer"&gt;DBeaver&lt;/a&gt; - a database management tool&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From Aiven you'll get the required connection information as below;&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzy5c93yotbcqpvwvkycz.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzy5c93yotbcqpvwvkycz.png" alt=" " width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After successful connection, DBeaver is as below;&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyqelxi5jdw1aljlj1yai.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyqelxi5jdw1aljlj1yai.png" alt=" " width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Importation
&lt;/h2&gt;

&lt;p&gt;To import data to DBeaver, on the left side expand on &lt;em&gt;&lt;strong&gt;databases&lt;/strong&gt;&lt;/em&gt; &amp;gt; &lt;strong&gt;&lt;em&gt;defaultdb&lt;/em&gt;&lt;/strong&gt; &amp;gt; &lt;em&gt;&lt;strong&gt;schemas&lt;/strong&gt;&lt;/em&gt; &amp;gt; either create a new schema or use the public schema&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiyp3ooojd8k2usept3un.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiyp3ooojd8k2usept3un.png" alt=" " width="799" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Right click on your preffered schema and click &lt;em&gt;&lt;strong&gt;import data&lt;/strong&gt;&lt;/em&gt;. Brings you to the window below&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F87vw2ytuvm0m46kpux09.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F87vw2ytuvm0m46kpux09.png" alt=" " width="799" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to -&amp;gt; &lt;strong&gt;&lt;em&gt;Input file(s)&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;Browse&lt;/em&gt;&lt;/strong&gt; and select your data&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyhbjy01d73u3ra8tqv1b.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyhbjy01d73u3ra8tqv1b.png" alt=" " width="799" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;&lt;em&gt;Proceed&lt;/em&gt;&lt;/strong&gt; at the bottom, till its done. After importing is done you should see&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj3hipkq4chs0u9kwzmws.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj3hipkq4chs0u9kwzmws.png" alt=" " width="800" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Voila, you just imported a file to aiven database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting Power BI to the Database
&lt;/h2&gt;

&lt;p&gt;Now we have the file in a database. In order to work on the data and visualize it, we connect our visualization tool to the database.&lt;/p&gt;

&lt;p&gt;Open &lt;strong&gt;Power BI Desktop&lt;/strong&gt; on your computer&lt;br&gt;
Click &lt;strong&gt;&lt;em&gt;Get Data&lt;/em&gt;&lt;/strong&gt; in the Home ribbon and select &lt;strong&gt;&lt;em&gt;More&lt;/em&gt;&lt;/strong&gt;&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fir77ri8i988rktfpq46h.JPG" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fir77ri8i988rktfpq46h.JPG" alt=" " width="800" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the dialog box, search for &lt;strong&gt;&lt;em&gt;PostgreSQL database&lt;/em&gt;&lt;/strong&gt; under the &lt;strong&gt;&lt;em&gt;Database&lt;/em&gt;&lt;/strong&gt; category and click &lt;strong&gt;&lt;em&gt;Connect&lt;/em&gt;&lt;/strong&gt;&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Felx8cxte93tbs5xme8w3.JPG" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Felx8cxte93tbs5xme8w3.JPG" alt=" " width="800" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Input server and database details gotten from the connection information on Aiven.&lt;br&gt;
&lt;strong&gt;Server&lt;/strong&gt; -&amp;gt; &lt;em&gt;Host&lt;/em&gt;:&lt;em&gt;Port&lt;/em&gt; &lt;br&gt;
&lt;strong&gt;Database&lt;/strong&gt; -&amp;gt; &lt;em&gt;Database name&lt;/em&gt;&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fokb7obw108rd4vfs3zwa.JPG" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fokb7obw108rd4vfs3zwa.JPG" alt=" " width="799" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After a successful connection, check the data under navigator.&lt;br&gt;
You'll get a preview and you can choose either to &lt;strong&gt;&lt;em&gt;load&lt;/em&gt;&lt;/strong&gt; or &lt;em&gt;&lt;strong&gt;transform the data&lt;/strong&gt;&lt;/em&gt; on Power BI.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F51mvmda8sisy9vp0dzth.JPG" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F51mvmda8sisy9vp0dzth.JPG" alt=" " width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To connect to the local postgreSQL, the only difference is the connection information used.&lt;br&gt;
Server -&amp;gt; &lt;code&gt;localhost&lt;/code&gt; or the &lt;em&gt;IP address&lt;/em&gt;&lt;br&gt;
Database -&amp;gt; &lt;em&gt;Database name&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;With these steps in place, you are well-equipped to leverage PostgreSQL data in Power BI for interactive analysis and informed decision-making.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Joins, Relationships and Schemas in Power BI</title>
      <dc:creator>rose odiwuor</dc:creator>
      <pubDate>Mon, 29 Jun 2026 21:23:37 +0000</pubDate>
      <link>https://dev.to/rose_odiwuor/joins-relationships-and-schemas-in-power-bi-3f06</link>
      <guid>https://dev.to/rose_odiwuor/joins-relationships-and-schemas-in-power-bi-3f06</guid>
      <description>&lt;h2&gt;
  
  
  &lt;u&gt;Joins&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;Imagine you have two separate tables with a common column and you'd like to merge them into one table.&lt;br&gt;
Joins help in merging such kind of tables by using the "Merge Queries" feature in Power BI.&lt;/p&gt;

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

&lt;h4&gt;
  
  
  1. Inner Join
&lt;/h4&gt;

&lt;p&gt;Returns only rows with matching values in both tables. If there is no match, the row is not included in the result.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Left Join / Left Outer Join
&lt;/h4&gt;

&lt;p&gt;Returns all records from the left table and matching rows from the right table. If there is no match, the result will contain null values for columns from the rights table.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Right Join / Right Outer Join
&lt;/h4&gt;

&lt;p&gt;Returns all records from the right table with matching values from the left table. If there is no match, the result will contain null values for columns from the left table.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. Full Join / Full Outer Join
&lt;/h4&gt;

&lt;p&gt;Returns all records from both tables, with matching values from both sides where available. If there is no match, the result will contain null values for columns from the table that lacks a match.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. Left Antijoin
&lt;/h4&gt;

&lt;p&gt;Returns records from the left table that don't have matches on the right table.&lt;/p&gt;

&lt;h4&gt;
  
  
  6. Right Antijoin
&lt;/h4&gt;

&lt;p&gt;Returns records from the right table that don't have matches on the left table.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwedcp8qfrk2dricv7s1i.JPG" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwedcp8qfrk2dricv7s1i.JPG" alt="Types of joins in a ven diagram" width="544" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Relationships&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;Managing relationships in Power BI is crucial for connecting multiple table and enabling accurate data analysis and visualization.&lt;br&gt;
Relationships define how tables interact.&lt;br&gt;
A model relationship relates one column in a table to one column in a different table.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Cardinality&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;Each model relationship is defined by a cardinality type. It defines how rows in one table relate to rows in another table.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One-to-many(1:*)&lt;/strong&gt; and &lt;strong&gt;Many-to-one(*:1)&lt;/strong&gt; - are essentially the same and the most common. The "one" side means the column contains unique values; the "many" side means the column can contain duplicate values.&lt;/li&gt;
&lt;/ul&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmqdk3sebbrqp8uvafjvk.JPG" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmqdk3sebbrqp8uvafjvk.JPG" alt="one-to-many/many-to-one" width="743" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;One-to-one(1:1)&lt;/strong&gt; - Both columns, in the different tables, contain unique values. It isn't common, and it likely represents a suboptimal model design because of the storage of redundant data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Many-to-many(&lt;em&gt;:&lt;/em&gt;)&lt;/strong&gt; - Both columns can contain duplicate values. This cardinality type is infrequently used.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Schemas&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;This is how &lt;em&gt;&lt;strong&gt;facts&lt;/strong&gt;&lt;/em&gt; and &lt;em&gt;&lt;strong&gt;dimension&lt;/strong&gt;&lt;/em&gt; tables are structured after modelling. &lt;br&gt;
-&amp;gt; Facts table - records of what happened&lt;br&gt;
-&amp;gt; Dimension table -&amp;nbsp;contains a common column with the facts table&lt;/p&gt;

&lt;h3&gt;
  
  
  Star schema
&lt;/h3&gt;

&lt;p&gt;Has one facts table with multiple dimension tables&lt;/p&gt;

&lt;h3&gt;
  
  
  Snowflake schema
&lt;/h3&gt;

&lt;p&gt;It's more like star schema (one facts table with multiple dimension tables), but one dimension table will not be directly related to the facts table.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo7ykrl4c65p5ur6sdeaf.JPG" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo7ykrl4c65p5ur6sdeaf.JPG" alt="star vs snowflake schema" width="421" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
By understanding joins, relationships and schemas in Power BI, we can create meaningful connections between datasets and generate reliable insights for better decision-making. &lt;br&gt;
Mastering these fundamentals provides a strong foundation for developing powerful and interactive Power BI reports.&lt;/p&gt;

</description>
      <category>beginners</category>
    </item>
    <item>
      <title>HOW EXCEL IS USED IN REAL-WORLD DATA ANALYSIS</title>
      <dc:creator>rose odiwuor</dc:creator>
      <pubDate>Sun, 07 Jun 2026 20:20:41 +0000</pubDate>
      <link>https://dev.to/rose_odiwuor/how-excel-is-used-in-real-world-data-analysis-2ceh</link>
      <guid>https://dev.to/rose_odiwuor/how-excel-is-used-in-real-world-data-analysis-2ceh</guid>
      <description>&lt;h2&gt;
  
  
  What is Excel?
&lt;/h2&gt;

&lt;p&gt;Everything we do nowadays forms part of data that can be useful to an organization or individual. This leads to the need for data collection. Excel therefore helps us to organize this data in rows and columns, stores the data and analysis can be done to generate insights.&lt;/p&gt;

&lt;h2&gt;
  
  
  Uses of Excel in real-world Data Analysis:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sales data&lt;/strong&gt; from a supermarket can be used to determine fast moving products and those that bring in most revenue; from which they ensure adequate stock of those two categories.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Customer feedback&lt;/strong&gt; to an organization can be analyzed to get information on areas that need improvement, what is working well and even suggest what products/services they'd like to be introduced.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We use excel to &lt;strong&gt;track daily, monthly, annual expenditures&lt;/strong&gt; of organizations and individuals. As an individual you can get to know how much you spend on different categories and how you can best optimize your income and expenses.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Excel features &amp;amp; formulas learned so far:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Data types we have in excel are numeric and alphabetic. Numeric data types include currency, percentage, date. Alphabetic data are basically in text format.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Formula bar is a toolbar that is used to enter, view and edit cell contents.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inserting a new row/column by selecting a row/column, right click and select insert.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The categories of functions;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Aggregate / Mathematical functions - SUM(), AVERAGE(), MIN(), MAX() &lt;/li&gt;
&lt;li&gt;Statistical functions - COUNT(), COUNTIF(), COUNTIFS()&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Personal Reflection:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  How has learning Excel changed the way I see data?
&lt;/h3&gt;

&lt;p&gt;Usually when presented with a large dataset I can 'freeze' from the sight of it all and wonder where to start from. But learning excel and its features ensures that I understand the process of data collection, cleaning, analysis, visualization and generating insights. &lt;/p&gt;

</description>
      <category>beginners</category>
    </item>
  </channel>
</rss>
