<?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: Peter Michalik</title>
    <description>The latest articles on DEV Community by Peter Michalik (@peter_michalik_3fa5d9225a).</description>
    <link>https://dev.to/peter_michalik_3fa5d9225a</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%2F4120448%2F4086061e-85a3-4d23-afe1-481947f89dd0.jpg</url>
      <title>DEV Community: Peter Michalik</title>
      <link>https://dev.to/peter_michalik_3fa5d9225a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/peter_michalik_3fa5d9225a"/>
    <language>en</language>
    <item>
      <title>How I Built a Real Estate ROI Calculator Using Supabase &amp; Looker Studio</title>
      <dc:creator>Peter Michalik</dc:creator>
      <pubDate>Fri, 11 Sep 2026 07:50:11 +0000</pubDate>
      <link>https://dev.to/peter_michalik_3fa5d9225a/how-i-built-a-real-estate-roi-calculator-using-supabase-looker-studio-1m77</link>
      <guid>https://dev.to/peter_michalik_3fa5d9225a/how-i-built-a-real-estate-roi-calculator-using-supabase-looker-studio-1m77</guid>
      <description>&lt;h1&gt;
  
  
  How I Built a Real Estate ROI Calculator Using Supabase &amp;amp; Looker Studio
&lt;/h1&gt;

&lt;p&gt;When investing in real estate, raw property prices only tell half the story. To identify the most profitable investment opportunities in Poprad (Slovakia), I built an end-to-end data pipeline and interactive BI dashboard. &lt;/p&gt;

&lt;p&gt;By combining &lt;strong&gt;Supabase (PostgreSQL)&lt;/strong&gt; for data storage and transformations with &lt;strong&gt;Google Looker Studio&lt;/strong&gt; for visualization, this project provides property investors with real-time ROI calculations and geographic price distribution.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key Finding:&lt;/strong&gt; While the &lt;em&gt;Veľká&lt;/em&gt; district commands the highest average price per m², older 1-bedroom apartments near the city center offer the highest annual ROI (&lt;strong&gt;~5.8% to 10%&lt;/strong&gt; depending on specific market conditions).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🛠️ Tech Stack &amp;amp; Architecture
&lt;/h2&gt;

&lt;p&gt;The architecture was kept lean, robust, and scalable:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Database Layer:&lt;/strong&gt; Supabase (PostgreSQL) — data storage, cleaning, and aggregation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analytical Layer:&lt;/strong&gt; Advanced SQL — window functions (&lt;code&gt;LAG&lt;/code&gt;), date truncations, and anomaly filtering.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BI &amp;amp; Visualization:&lt;/strong&gt; Google Looker Studio — custom calculated fields (&lt;code&gt;ROI%&lt;/code&gt;, &lt;code&gt;Estimated Rent&lt;/code&gt;) and interactive UI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation &amp;amp; Version Control:&lt;/strong&gt; GitHub Markdown &amp;amp; Public Repository.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🔍 Data Cleaning &amp;amp; SQL Transformations
&lt;/h2&gt;

&lt;p&gt;Raw data often contains outliers (e.g., mispriced listings or inaccurate square footage). Before building visualizations, I filtered out non-representative listings using custom SQL constraints.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Removing Price Anomalies
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
sql
SELECT * 
FROM poprad_reality
WHERE (cena_eur / rozloha_m2) BETWEEN 800 AND 6000;

2. Year-over-Year Growth Trend (Window Functions)
To analyze how prices evolved over time, I implemented the LAG window function to calculate percentage growth year-over-year:

SQL
WITH yearly_averages AS (
    SELECT 
        EXTRACT(YEAR FROM datum_inzercie::date) AS year,
        AVG(cena_eur / rozloha_m2) AS price_per_m2
    FROM poprad_reality
    WHERE typ_nehnutelnosti LIKE '%byt%'
    GROUP BY EXTRACT(YEAR FROM datum_inzercie::date)
)
SELECT 
    year,
    ROUND(price_per_m2::numeric, 2) AS avg_price_m2,
    ROUND((LAG(price_per_m2) OVER (ORDER BY year))::numeric, 2) AS previous_year_price,
    ROUND((((price_per_m2 - LAG(price_per_m2) OVER (ORDER BY year)) / LAG(price_per_m2) OVER (ORDER BY year)) * 100)::numeric, 2) AS yoy_growth_percent
FROM yearly_averages;
📊 BI Dashboard &amp;amp; Interactive ROI Calculator
In Google Looker Studio, I designed custom metrics to evaluate financial viability directly on the dashboard:

Estimated Annual Rent (€): rozloha_m2 * 10 * 12 (based on a conservative average market rent of 10 €/m²/month)

ROI (%): (rozloha_m2 * 10 * 12) / cena_eur

Key UI Features:
Interactive Slicers: Filter instantly by location (lokalita) and property type (typ_nehnutelnosti).

KPI Scorecards: Overview of global average ROI and pricing metrics.

Granular Breakdown Table: Location-based aggregation showing average area (m²), calculated ROI (%), and total price (€).

Comparative Bar Chart: Side-by-side ROI distribution across property categories.

💡 Business Recommendations for Investors
High-Yield Target: Focus on 1-room and 2-room apartments in high-density residential areas (Poprad - Juh, Centrum). They provide the best balance between purchase price and steady rental yield.

Capital Appreciation vs. Yield: Properties in Veľká offer great long-term value preservation due to proximity to the High Tatras, but yield lower immediate rental returns due to higher acquisition costs.

🔗 Live Links &amp;amp; Repository
📊 Interactive Looker Studio Dashboard

📁 GitHub Repository
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>postgres</category>
      <category>sql</category>
      <category>lookerstudio</category>
      <category>dataanalysis</category>
    </item>
  </channel>
</rss>
