<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Precious Celestine on Medium]]></title>
        <description><![CDATA[Stories by Precious Celestine on Medium]]></description>
        <link>https://medium.com/@preciousccelestine?source=rss-71e3c13f89db------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0VKDUGoOI49Liiq8</url>
            <title>Stories by Precious Celestine on Medium</title>
            <link>https://medium.com/@preciousccelestine?source=rss-71e3c13f89db------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 07:49:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@preciousccelestine/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Stop Measuring Everything. Start Measuring What Moves the Business.]]></title>
            <link>https://medium.com/@preciousccelestine/stop-measuring-everything-start-measuring-what-moves-the-business-3cd5f3d656d9?source=rss-71e3c13f89db------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cd5f3d656d9</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[kpi-dashboard]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[Precious Celestine]]></dc:creator>
            <pubDate>Thu, 10 Sep 2026 13:43:29 GMT</pubDate>
            <atom:updated>2026-09-10T13:43:29.304Z</atom:updated>
            <content:encoded><![CDATA[<p>A simple 4-step framework for choosing KPIs that actually drive decisions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YC0JX2loGsqQhHkCbeKUPw.png" /></figure><p>Picture a typical executive dashboard: 47 metrics, 12 colourful charts, three slicers, and one suspiciously dramatic red arrow pointing somewhere ominous. It looks impressive in the boardroom. Nobody in the room can tell you what to do next.</p><p>That’s the trap. More numbers do not automatically create more insight — in fact, measuring everything usually makes the story <em>harder</em> to understand, not easier. A dashboard’s job isn’t to prove you collected a lot of data. It’s to answer one question:</p><blockquote><strong><em>Are we moving toward our goal?</em></strong></blockquote><p>If a metric can’t help answer that, it doesn’t belong on the dashboard — no matter how easy it was to pull.</p><h3>The problem: just because you can measure it doesn’t mean it should be a KPI</h3><p>Most BI teams don’t fail because they lack data. They fail because they never decided which numbers actually matter. Every table in the warehouse becomes a candidate KPI, every chart earns a spot on the dashboard, and the result is 47 metrics competing for a decision-maker’s attention span of about eleven seconds.</p><p>Here’s the rule I use to sort signal from noise:</p><p><strong>Just because you can measure something doesn’t mean it deserves a seat at the KPI table.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QvhO1QeEKq6Hs3zYKgf1Yw.png" /></figure><h3>The framework: Business Goal → Metric → Target → Decision</h3><p>The way out of KPI overload isn’t a smarter chart — it’s a sharper filter, applied <em>before</em> anything gets built. I use a four-step chain, and every proposed KPI has to walk through it in order:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tZX2AinadQpF0NTppYKN3g.png" /></figure><p>Each step in the chain answers a different question:</p><ul><li><strong>Business goal</strong> — What are we trying to achieve?</li><li><strong>Metric</strong> — What shows whether we’re making progress?</li><li><strong>Target</strong> — What level of performance are we aiming for?</li><li><strong>Decision</strong> — What action should we take if performance changes?</li></ul><p>Skip a step, and you get a number that’s interesting but useless. Walk the whole chain, and you get a KPI someone can actually act on. Let’s go through it.</p><h3>1. Start with the business goal</h3><p>Everything begins here, and it’s the step most teams quietly skip.</p><blockquote><strong><em>Goal:</em></strong><em> Increase online revenue by 15%.</em></blockquote><p>A goal like this gives the whole analysis a direction. Without one, it’s tempting to pick metrics simply because the data happens to be sitting there in a table — which is exactly how dashboards end up with 47 charts and no story.</p><h3>2. Choose the metrics that explain progress</h3><p>Once the goal is clear, ask which numbers actually move it. For a revenue goal, that might be conversion rate, average order value, repeat purchase rate, and customer acquisition cost. Notice what these have in common: each one explains a <em>different driver</em> of the same goal. That’s the point of this step — not to list everything you can measure, but to isolate the handful of levers that actually explain the outcome.</p><p>If you’re building these out in Power BI, it’s worth seeing them as actual DAX measures — not just concepts. A quick note before the formulas: build these as <strong>measures</strong>, not calculated columns. A calculated column freezes a value per row at refresh time; a measure recalculates live against whatever filter context your slicers, dates, or dashboard visuals apply. KPIs live and die by that context, so measures are almost always the right tool.</p><p><strong>Conversion rate</strong> — Are more visitors becoming customers?</p><p>dax</p><pre>Conversion Rate =<br>DIVIDE(<br>    [Total Orders],<br>    [Total Visitors],<br>    0<br>)</pre><p><em>What it needs:</em> a Total Orders measure (usually COUNTROWS(Sales) or a distinct count of order IDs) and a Total Visitors measure, typically pulled from web analytics or an events table (DISTINCTCOUNT(WebEvents[SessionID])).</p><p><em>How it works:</em> DIVIDE() is DAX&#39;s safe division function — it takes numerator, denominator, and a fallback value (here, 0) to return instead of throwing an error when the denominator is blank or zero. Without it, a period with zero visitors would crash the visual with #ERROR instead of quietly showing 0%.</p><p><em>Watch for:</em> mismatched grain. If Total Visitors comes from a different fact table than Total Orders, make sure both roll up to the same date and segment — otherwise the ratio will look &quot;correct&quot; but compare numbers that were never meant to sit together.</p><p><strong>Average order value</strong> — Are customers spending more per purchase?</p><p>dax</p><pre>Average Order Value =<br>DIVIDE(<br>    [Total Revenue],<br>    [Total Orders],<br>    0<br>)</pre><p><em>What it needs:</em> Total Revenue (SUM(Sales[LineTotal])) and Total Orders (a distinct count of Sales[OrderID], not COUNTROWS, if one order can span multiple line-item rows).</p><p><em>How it works:</em> this is the simplest measure of the four — total money in divided by number of orders — but it’s a good illustration of why the <em>denominator’s definition</em> matters as much as the formula. Get “Total Orders” wrong (counting line items instead of orders) and AOV silently deflates.</p><p><em>Watch for:</em> refunds and cancellations. Decide up front whether Total Revenue is gross or net of returns, and keep it consistent with how the business goal (&quot;increase revenue by 15%&quot;) is defined — otherwise the metric and the goal are quietly measuring two different things.</p><p><strong>Repeat purchase rate</strong> — Are existing customers returning?</p><p>dax</p><pre>Repeat Purchase Rate =<br>VAR CustomersWithMultipleOrders =<br>    CALCULATE(<br>        DISTINCTCOUNT( Sales[CustomerID] ),<br>        FILTER(<br>            VALUES( Sales[CustomerID] ),<br>            CALCULATE( COUNTROWS( Sales ) ) &gt; 1<br>        )<br>    )<br>RETURN<br>DIVIDE(<br>    CustomersWithMultipleOrders,<br>    DISTINCTCOUNT( Sales[CustomerID] ),<br>    0<br>)</pre><p><em>What it needs:</em> a Sales fact table with a CustomerID column and one row per order (or per line item, as long as you&#39;re consistent about it).</p><p><em>How it works, step by step:</em></p><ol><li>VALUES( Sales[CustomerID] ) produces one row per distinct customer in the current filter context.</li><li>FILTER(...) walks through that list and keeps only the customers whose order count, recalculated with CALCULATE( COUNTROWS( Sales ) ), is greater than 1 — i.e., customers who bought more than once.</li><li>DISTINCTCOUNT on the filtered table gives you the count of repeat customers.</li><li>The final DIVIDE turns that into a percentage of all customers in the period.</li></ol><p><em>Watch for:</em> the time window. “Repeat” only means something relative to a period — repeat within 30 days is a very different (and usually more useful) signal than repeat ever. Add a date filter or a DATESINPERIOD() wrapper if you want rolling-window behavior rather than lifetime behavior.</p><p><strong>Customer acquisition cost</strong> — Are we growing efficiently?</p><p>dax</p><pre>Customer Acquisition Cost =<br>DIVIDE(<br>    [Total Marketing Spend],<br>    [New Customers Acquired],<br>    0<br>)</pre><p><em>What it needs:</em> a marketing spend table (often a separate fact table loaded from ad platforms or finance) and a measure for New Customers Acquired — usually the count of customers whose <em>first-ever</em> order falls inside the selected period, which itself typically needs a small helper measure using FIRSTDATE() or a min-order-date column per customer.</p><p><em>How it works:</em> it’s a simple ratio on the surface, but almost all the real work is in defining “new.” If New Customers Acquired accidentally counts every customer who ordered in the period (not just first-timers), CAC will look artificially cheap and hide a real efficiency problem.</p><p><em>Watch for:</em> which costs are in scope. Paid media only? Or paid media plus content, tooling, and a share of the sales team’s time? Agree this with finance once, document it next to the measure, and don’t let it drift between reporting periods.</p><p>Two habits carry across all four measures. First, DIVIDE() everywhere instead of the / operator — it&#39;s the difference between a dashboard that shows a clean 0% on a slow day and one that shows #ERROR in front of an executive. Second, name your base measures (Total Orders, Total Revenue, Total Visitors) once and reuse them inside every ratio — it keeps the definition of &quot;an order&quot; consistent everywhere it&#39;s used, instead of redefined slightly differently in four different KPIs.</p><h3>3. Attach a target to every metric</h3><p>A metric without a target is just trivia. It’s a number floating in space with no way to tell if it’s good, bad, or irrelevant.</p><ul><li>Conversion rate: increase from <strong>2.5% to 3%</strong></li><li>Average order value: increase from <strong>₦25,000 to ₦28,000</strong></li><li>Repeat purchase rate: increase by <strong>10% year over year</strong></li><li>Customer acquisition cost: keep <strong>below ₦8,000</strong></li></ul><p>The target is what gives the number meaning. “Conversion rate is 2.7%” tells you nothing on its own. “Conversion rate is 2.7%, against a target of 3%” tells you exactly where you stand.</p><h3>4. Connect every metric to a decision</h3><p>This is the step that separates a real KPI from a vanity metric. Ask, for each one:</p><p><strong>If this number changes, what action should someone actually take?</strong></p><ul><li>If conversion rate falls → investigate the checkout journey or campaign traffic.</li><li>If average order value declines → review pricing, bundles, or product mix.</li><li>If repeat purchase rate falls → examine retention campaigns and customer experience.</li><li>If acquisition cost rises → reassess marketing channels and campaign efficiency.</li></ul><p>This is where a KPI stops being decoration and starts being useful for decision-making rather than just reporting.</p><h3>The test to run before adding any metric to a dashboard</h3><p>Before a number earns a spot on your headline dashboard, see if you can complete the full sequence:</p><blockquote><strong><em>Business goal:</em></strong><em> Increase online revenue by 15%. </em><strong><em>Metric:</em></strong><em> Conversion rate. </em><strong><em>Target:</em></strong><em> Increase from 2.5% to 3%. </em><strong><em>Decision:</em></strong><em> Investigate the customer journey if conversion falls below target.</em></blockquote><p>If you can’t connect a metric to a goal, a target, <em>and</em> a decision, it might still be useful for deeper analysis — but it probably shouldn’t be a headline KPI. Keep it in the exploratory workbook. Don’t give it a seat at the table.</p><h3>The best analysts don’t measure everything</h3><p>They identify what matters, connect it to a business objective, and use it to support better decisions. That’s a discipline, not a talent — and it’s one anyone building dashboards can apply starting with the next metric they’re tempted to add.</p><p>Before you finalize a KPI, ask yourself:</p><ol><li>What is the business trying to achieve?</li><li>Which number shows whether we’re making progress?</li><li>What target or comparison gives that number meaning?</li><li>What action should someone take if the number changes?</li></ol><p>That’s the difference between reporting numbers and creating insight.</p><p>A dashboard should never make people say <em>“wow, so many charts.”</em> It should make them say:</p><p><strong>“Now I know what’s happening — and what we need to do next.”</strong></p><p>Lets connect <a href="http://www.linkedin.com/in/preciousccelestine">www.linkedin.com/in/preciousccelestine</a> for practical, no-fluff lessons on Data, Business Intelligence, and AI — and learn how to turn data into decisions that move the business forward.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cd5f3d656d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Used Product Hierarchy, Normalization & Denormalization to Build a Better Investment Report]]></title>
            <link>https://medium.com/@preciousccelestine/how-i-used-product-hierarchy-normalization-denormalization-to-build-a-better-investment-report-b318d7691f56?source=rss-71e3c13f89db------2</link>
            <guid isPermaLink="false">https://medium.com/p/b318d7691f56</guid>
            <dc:creator><![CDATA[Precious Celestine]]></dc:creator>
            <pubDate>Thu, 03 Jul 2025 22:12:55 GMT</pubDate>
            <atom:updated>2025-07-03T22:12:55.395Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gGqT7W_vuvsUA5ZdwxKtZA.jpeg" /></figure><p>Every business generates data daily ,transactions, products sold, services rendered, investments made. But raw data sitting in spreadsheets doesn’t help anyone. What matters is how you organize it to answer real questions.</p><p>Recently, I worked on a report for an investment tech company. The goal was simple: help stakeholders understand how their money was spread across different asset classes, product lines, an individual securities, and make it easy to see the bigger picture at a glance.</p><p>To get there, I leaned on three essential ideas: <strong>product hierarchy</strong>, <strong>data normalization</strong>, and <strong>denormalization</strong>. Here’s how they came together.</p><h3><strong>Product Hierarchy: Putting Structure Around Chaos</strong></h3><p>Think of a product hierarchy as a family tree for your products or services. Instead of lumping everything together in a single long list, you break it down step by step — from broad to specific.</p><p>For this report, the hierarchy looked something like this:</p><ul><li><strong>Asset Class / Product Category:</strong> Equities</li><li><strong>Sub-Class/ Sector:</strong> Local Equities</li><li><strong>Product:</strong> Blue Chip Stocks</li><li><strong>Security:</strong> Company XYZ</li></ul><p>This simple structure made it clear how individual transactions rolled up into bigger groups. It helped answer questions like: <em>Where is most of the money invested? Which product lines are performing best?</em></p><h3><strong>Data Normalization: Keeping Things Clean</strong></h3><p>Once the hierarchy was clear, the next step was to make sure the raw data was stored in a way that avoided duplicates and errors. This is where <strong>normalization</strong> comes in.</p><p>Instead of repeating “Equities” thousands of times in every transaction record, I split the data into separate tables:</p><ul><li>An <strong>Asset Classes</strong> table with unique IDs and names.</li><li>A <strong>Products</strong> table linked to asset classes.</li><li>A <strong>Securities</strong> table linked to products.</li><li>A <strong>Transactions</strong> table linked to securities.</li></ul><p>So if the name of an asset class changed, it only needed to be updated once. No more hunting through endless rows. So when your boss asks you to update an asset class name, you do it <em>once</em> not in every row.</p><p><strong>Benefits:</strong><br> 1. Saves storage space.<br> 2. Avoids inconsistent data.<br> 3. Makes your data model clean and flexible for future growth.</p><h3><strong>The Role of Joins</strong></h3><p>Once your data is normalized, you need <strong>joins</strong> to pull it together when analyzing it.</p><p><strong>A join</strong> combines data from two or more tables based on a related column, like an ID.</p><p>For my investment report, I needed to calculate total investments by asset class. I joined:</p><ul><li><strong>Transactions → Securities → Products → Asset Classes</strong></li></ul><p>With these joins, I could roll up every transaction to its correct product line and asset class.</p><p><strong>Common joins you should know:</strong></p><ul><li><strong>INNER JOIN:</strong> Only rows with matching values in both tables.</li><li><strong>LEFT JOIN:</strong> All rows from the left table, plus matches from the right.</li><li><strong>RIGHT JOIN:</strong> The opposite of LEFT JOIN.</li><li><strong>FULL JOIN:</strong> All rows from both tables, matched where possible.</li></ul><h3><strong>When to Use Denormalization</strong></h3><p>Here’s the flip side: while normalization keeps your storage clean, too many joins can slow things down — especially in big dashboards.</p><p>That’s why we use <strong>denormalization</strong>: intentionally combining related tables into a single “flattened” table for faster queries and reports.</p><p><strong>Example:</strong><br> Instead of joining four tables every time you run a dashboard, you might store the asset class name directly in the transactions data export.</p><p>In my case, I kept the raw data normalized for accuracy, but created a <strong>denormalized view</strong> for Power BI dashboards. This way, end users could slice and dice data <em>fast</em> — no long queries needed.</p><p>Good data design balances both worlds. Normalization keeps your data tidy and reliable. Denormalization makes it practical to work with when people need answers quickly. A clear product hierarchy ties it all together so you can move from raw data to useful insights — without getting lost in messy spreadsheets.</p><p>If you run a business or work with data, these ideas are worth keeping in your toolkit. They can turn your daily records into real insights that save money, uncover opportunities, and make your life a lot easier.</p><p><em>Thanks for reading! If you found this useful, follow me on </em><a href="https://medium.com/@preciousccelestine/www.linkedin.com/in/preciousccelestine">LinkedIn</a> <em>for more practical data tips.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b318d7691f56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Date Columns and Time Intelligence in SQL]]></title>
            <link>https://medium.com/@preciousccelestine/mastering-date-columns-and-time-intelligence-in-sql-90c2ec4a28c3?source=rss-71e3c13f89db------2</link>
            <guid isPermaLink="false">https://medium.com/p/90c2ec4a28c3</guid>
            <category><![CDATA[storytelling]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[time-series-analysis]]></category>
            <category><![CDATA[time-intelligence]]></category>
            <dc:creator><![CDATA[Precious Celestine]]></dc:creator>
            <pubDate>Tue, 29 Apr 2025 22:16:41 GMT</pubDate>
            <atom:updated>2025-04-29T22:16:41.288Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xDeVfCS89AvVmkJo" /><figcaption>Photo by <a href="https://unsplash.com/@murrayc?utm_source=medium&amp;utm_medium=referral">Murray Campbell</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Working with dates and time is one of the most critical skills in data analysis. Whether you’re tracking user signups, analyzing transaction timelines, or building reports for financial forecasting, understanding how to manipulate and extract insights from date fields is non-negotiable.</p><p>In this post, I’ll walk you through the different types of date columns you’ll encounter, the SQL functions you need to transform them, and how to apply <strong>time intelligence</strong> in your analysis, now get you shoes on .</p><h3>Types of Date Columns You’ll Encounter</h3><ol><li><strong>DATE</strong> : Its is sorted in this format <strong>“2025–04–10” </strong>this only store the date alone, i.e, the year, month and day.</li><li><strong>DATETIME or TIMESTAMP : </strong>This stores both date and time together, e.g. <strong>“2025–04–10 13:45:00”.</strong></li><li><strong>TEXT/VARCHAR</strong> : This is just date stored in text format.</li><li><strong>UNIX Timestamp (Milliseconds):</strong> This commonly found in APIs or backend systems and it saves time in milliseconds e.g. <strong>“1712755200000”</strong></li><li><strong>UNIX Timestamp (Seconds) </strong>: This is similar to <strong>UNIX Timestamp (Milliseconds), </strong>the difference it saves in seconds not milliseconds.</li></ol><h3><strong>Let’s Transform</strong></h3><p>The most used date data type in transformation is the <strong>DATE</strong>, lets work through transforming these date data types to the <strong>DATE </strong>type.</p><ol><li><strong>Convert UNIX Timestamp (Milliseconds) to Date :</strong></li></ol><pre>SELECT FROM_UNIXTIME(timestamp_column / 1000) AS cleaned_date<br>FROM transactions;</pre><p>2. <strong>Convert UNIX Timestamp (Seconds) to Date :</strong></p><pre>SELECT FROM_UNIXTIME(timestamp_column) AS cleaned_date<br>FROM transactions</pre><p>3.<strong>Convert DATETIME or TIMESTAMP to Date :</strong></p><pre>SELECT DATE(your_datetime_column) AS cleaned_date<br>FROM transactions;</pre><p>4.<strong>Convert TEXT/VARCHAR to Date :</strong></p><pre>SELECT CAST(&#39;2025-04-10&#39; AS DATE) AS cleaned_date;</pre><p>or if the format is non-standard use:</p><pre>SELECT STR_TO_DATE(&#39;10-04-2025&#39;, &#39;%d-%m-%Y&#39;) AS cleaned_date;</pre><p>Here are some other transformation scenarios that would come handy when you are working on a report that requires time intelligence.</p><p>5. <strong>Extract Specific Parts of a Date :</strong></p><p>Here are some functions used to break down a <strong>DATE</strong> or <strong>DATETIME</strong> column, these are perfect when you need to group or filter by specific time units.</p><pre>SELECT <br>  YEAR(created_at) AS year,<br>  MONTH(created_at) AS month,<br>  DAY(created_at) AS day,<br>  WEEK(created_at) AS week_number,<br>  HOUR(created_at) AS hour<br>FROM users;</pre><h3><strong>Analyze Trends Over Time</strong></h3><p>Date and time is very crucial in analysis, as it help us understand partners, project and plan for the future, e.t.c.</p><p>Few examples of real life scenairo where insights are unlock using time intelligence are :</p><ol><li>Compare This Period vs Last Period.</li><li>Calculate Rolling Averages or Totals.</li><li>Fitering data by time range , just to mention a few.</li></ol><p>Date columns can feel intimidating at first, especially when they come in strange formats. But with the right SQL transformations and time intelligence functions, you can turn them into your <strong>most powerful tool</strong> for uncovering insights.</p><p>So next time you see a cryptic timestamp or a messy VARCHAR pretending to be a date, remember:</p><ul><li>Normalize your dates first</li><li>Extract what you need</li><li>Layer time intelligence for analysis and tells that story</li></ul><p>If you have found this helpful, do not forget to like , share and connect on <a href="https://medium.com/@preciousccelestine/www.linkedin.com/in/preciousccelestine">LinkedIn</a>. Till we meet again my dear friend on this journey of compelling and insightful data story telling. <br>Cheers..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90c2ec4a28c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extracting Data from a JSON Array in SQL: A Real World Use Case in User Analysis]]></title>
            <link>https://medium.com/@preciousccelestine/extracting-data-from-a-json-array-in-sql-a-real-world-use-case-in-user-analysis-d5b4331cec58?source=rss-71e3c13f89db------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5b4331cec58</guid>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[etl-tool]]></category>
            <category><![CDATA[data-cleaning]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[data-transformation]]></category>
            <dc:creator><![CDATA[Precious Celestine]]></dc:creator>
            <pubDate>Mon, 14 Apr 2025 21:57:10 GMT</pubDate>
            <atom:updated>2025-04-14T21:57:10.306Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WYzgnA8bBQnyk4kpwgsjGA.jpeg" /></figure><p>Transformation is a key part of the data workflow. It’s the process of modifying or reshaping data to meet specific requirements, solve business problems, or simply make it more usable.</p><p>In the world of data, <strong>data transformation</strong> involves converting a dataset into a format that makes it easier to analyze. This could include:</p><ul><li>Changing a column’s data type.</li><li>Extracting information from unstructured text or nested objects.</li><li>Cleaning or standardizing inconsistent entries.</li><li>Working with complex formats like JSON, arrays, or embedded objects.</li></ul><p>Recently, while working on a <strong>user demographic analysis report</strong>, I encountered a real-world challenge that perfectly illustrates the importance of mastering data transformation. I needed to extract users’ gender information from a banking table. However, the user data wasn’t spread across multiple columns, it was embedded as a <strong>JSON object inside a single column</strong> called lookup.</p><p>This scenario is pretty common in fintech and modern databases, especially when storing API responses or third-party service data. To carry out meaningful analysis, I had to extract specific fields from these JSON arrays directly in SQL ,and here’s exactly how I did it.</p><p>Here’s an example of the kind of JSON data stored inside the lookup column:</p><pre>{<br>  &quot;bvn&quot;: {<br>    &quot;firstname&quot;: &quot;Sarah&quot;,<br>    &quot;gender&quot;: &quot;female&quot;,<br>    &quot;age&quot;: &quot;30&quot;,<br>    &quot;dob&quot;: &quot;1990-05-01&quot;<br>  },<br>  &quot;error&quot;: {<br>    &quot;Bad Request&quot;: &quot;Invalid BVN provided&quot;<br>  }<br>}</pre><h3><strong>Let me walk you through some possible steps to solve this :</strong></h3><ol><li>Extracting a Simple Field</li></ol><pre>SELECT JSON_EXTRACT(lookup, &#39;$.bvn.firstname&#39;) AS firstname<br>FROM banks;</pre><p>In this instance <strong>JSON_EXTRACT() </strong>is used to retrieve the firstname from the bvn object. However, the result will include double quotes (“Sarah”) ,it adviceable to use this when you need to pull out a specific field and you’re okay working with the raw JSON string output.</p><p>2. Removing Quotes from the Output :</p><pre>SELECT DISTINCT <br>    JSON_UNQUOTE(JSON_EXTRACT(lookup, &#39;$.error.Bad Request&#39;)) AS response,<br>    status<br>FROM banks;</pre><p>This next step is taking the transformation further by taking out the quotes, as seen in step one <strong>JSON_EXTRACT() ,</strong>gets the field we are trying to work with, in this cases its the error message under the error object.<br>In the query above you would observe <strong>JSON_EXTRACT() </strong>is been wrapped<strong> JSON_UNQUOTE(), </strong>this removes the surrounding quotes and returns a clean string.<br>This combination is my go too as it returns a cleaner results ,especially when dealing with transformation that would be displayed, used for filtering, or comparison.</p><p>It gets interesting in certain situation these json are stored as text and there might be a need to convert then into a certain data type or repalcing null values to suits your analysis. This is where <strong>CAST()</strong> and <strong>COALESCE() </strong>comes in</p><p><strong>Let’s Take It Further:</strong></p><p>3. Using <strong>CAST()</strong></p><pre>SELECT <br>    CAST<br>(JSON_UNQUOTE(JSON_EXTRACT(lookup, &#39;$.bvn.age&#39;)) AS UNSIGNED) AS age<br>FROM banks;</pre><p>In this scenario <strong>CAST() </strong>was used to convert the age from text to interger.Here are few scenarios <strong>CAST() </strong>can also come in handy.</p><ul><li>You want to sort, compare, or aggregate numerical values</li><li>Your downstream or visualization tools (e.g., Power BI, Tableau) needs a proper data types</li></ul><p>4. Using <strong>COALESCE()</strong></p><pre>SELECT <br>    COALESCE<br>(<br>JSON_UNQUOTE(JSON_EXTRACT(lookup, &#39;$.bvn.gender&#39;)), &#39;Not Specified&#39;<br>) AS gender<br>FROM banks;</pre><p>In the query above I used <strong>COALESCE() </strong>to replace values in places where <strong>JSON_UNQUOTE(JSON_EXTRACT(lookup, ‘$.bvn.gender’)) </strong>had missing or null values. In these case I choose <em>‘Not Specified’.<br></em>Here are few scenario <strong>COALESCE() </strong>would be very useful:</p><ul><li>Avoid null values in your reports</li><li>Maintain clean and complete output for analysis or user display</li><li>Set defaults when certain fields are not guaranteed</li></ul><p>5. Combine all these commands together :</p><pre>SELECT <br>    COALESCE<br>(CAST(JSON_UNQUOTE(JSON_EXTRACT(lookup, &#39;$.bvn.age&#39;)) AS UNSIGNED), 0)<br> AS age,<br>    COALESCE<br>(JSON_UNQUOTE(JSON_EXTRACT(lookup, &#39;$.bvn.gender&#39;)), &#39;Not Specified&#39;)<br> AS gender<br>FROM banks;</pre><p>This query ensures:</p><ul><li>I got a clean, usable age as a number for statistical analysis on my report.</li><li>Also provided a gender value even when it wasn’t provided.</li></ul><p>In summary use :</p><ul><li><strong>JSON_EXTRACT()</strong> it helps you navigate nested fields in a JSON object</li><li><strong>JSON_UNQUOTE() </strong>it gives you cleaner string outputs</li><li><strong>CAST()</strong> it ensures proper data types for analysis</li><li><strong>COALESCE()</strong> it helps fill in the gaps when data is missing.</li></ul><p>In this blog post we have seen that data transformation is more than just cleaning ,it’s about making raw data <strong>actionable</strong>. In this case, by extracting gender and age directly from a JSON column, I was able to perform meaningful demographic analysis and drive insights for the business.</p><p>Whether you’re dealing with customer data, system logs, or API responses, knowing how to work with JSON in SQL gives you a serious edge.</p><p><strong>Stay tuned!</strong> I’ll be sharing more practical SQL tips, transformation hacks, and real-life data scenarios to level up your data skills.<br><strong>Found this helpful?</strong> Drop a comment, share your thoughts, or tag someone who should see this!<br>Let’s connect on <a href="https://medium.com/www.linkedin.com/in/preciousccelestine">LinkedIn</a> , I’m always happy to chat data and learn together!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5b4331cec58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Role of Logic in Problem Solving: A Data Analyst’s Superpower]]></title>
            <link>https://medium.com/@preciousccelestine/the-role-of-logic-in-problem-solving-a-data-analysts-superpower-eea40e8b235a?source=rss-71e3c13f89db------2</link>
            <guid isPermaLink="false">https://medium.com/p/eea40e8b235a</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[power-query]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Precious Celestine]]></dc:creator>
            <pubDate>Sun, 16 Mar 2025 20:57:14 GMT</pubDate>
            <atom:updated>2025-03-16T20:57:14.040Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HVFle32O5OQMtQ69" /><figcaption>Photo by <a href="https://unsplash.com/@uxindo?utm_source=medium&amp;utm_medium=referral">UX Indonesia</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As a data analyst, you’re often the detectives of the business world, sifting through data, uncovering hidden patterns, and solving mysteries that drive decision-making. But what’s the secret sauce behind great analysis? It’s not just about fancy tools or technical skills (though those are important too). It’s about <strong>critical thinking</strong> and <strong>problem-solving</strong>, and at the heart of these skills lies one powerful tool <strong>LOGIC</strong>.</p><p>In this blog post, I’ll take you on a journey through a real-world scenario where logic saved the day. I’ll show you how I used logical reasoning to tackle a tricky analysis for an invest-tech app, focusing on two key metrics: <strong>funded users</strong> and <strong>active users</strong>.</p><h3>Why Logic is a Data Analyst’s Best Friend</h3><p>Before we dive into the scenario, let’s talk about why logic is so important. Logic is the backbone of rational thinking. It helps you:</p><ul><li>Break down complex problems into manageable pieces.</li><li>Make sound decisions based on evidence, not assumptions.</li><li>Avoid common pitfalls like biases or flawed reasoning.</li><li>Communicate your findings clearly and convincingly.</li></ul><p>In short, logic is your superpower as a data analyst. It’s what turns you from a data cruncher into a problem-solving wizard.</p><h3>The Scenario: Unlocking User Insights for an Invest-Tech App</h3><p>I was tasked with analyzing user behavior for an invest-tech app. The goal was to uncover insights that would help the business understand its users better and improve engagement. Two key metrics we are going to focus on:</p><ol><li><strong>Funded Users</strong>: Users who had funded their wallets at least once.</li></ol><p><strong>2. Active Users</strong>: Users who had engaged with the app by investing in one of the products.</p><p>Sounds simple, right? Well, not so fast. The challenge was in the details, specifically on how to define and measure these metrics accurately.</p><h3>The Logic Behind Funded Users</h3><p>Let’s start with <strong>funded users</strong>. At first glance, it seemed straightforward: count the number of users who had made a deposit into their wallets. But here’s where logic came into play.</p><h4>The Problem</h4><p>The wallet transaction table recorded all types of transactions: deposits, withdrawals, and more. If I only counted users who had made deposits, I might miss users who had funded their accounts indirectly (e.g., through referrals or bonuses).</p><h4>The Logical Solution</h4><p>I applied a simple but powerful logic: <strong>you can’t withdraw money if you haven’t funded your account first</strong>. This meant that any user who had made a withdrawal must have funded their account at some point. So, instead of counting only deposit transactions, I counted <strong>distinct user IDs</strong> from the entire transaction table, ignoring the transaction type. This ensured that all users who had ever funded their accounts were captured ,whether through deposits, withdrawals, or other means.</p><p>Here’s the SQL-like logic I used:</p><pre>SELECT COUNT(DISTINCT user_id) AS funded user<br>FROM wallet_transactions;</pre><h3>The Logic Behind Active Users</h3><p>Next up was <strong>active users</strong>. The goal here was to identify users who had engaged with the app by investing in products. But the transaction table was a jungle of different transaction types: deposits, withdrawals, product purchases, and more.</p><h4>The Problem</h4><p>If I tried to hardcode all the possible transaction types related to product purchases, I’d risk missing some or overcomplicating the query. I needed a smarter, more logical approach.</p><h4>The Logical Solution</h4><p>Instead of focusing on specific transaction types, I flipped the script. I thought: <strong>any user who has performed a transaction (other than a withdrawal) is likely engaging with the app</strong>. So, I counted distinct user IDs from the transaction table, excluding withdrawals. This gave me a clean and accurate measure of active users.</p><p>Here’s how the logic looked in SQL-like terms:</p><pre>SELECT COUNT(DISTINCT user_id) AS active_users<br>FROM wallet_transactions<br>WHERE transaction_type &lt;&gt; &#39;withdrawal&#39;;</pre><h3>Why Logic Made All the Difference</h3><p>This approach wasn’t just efficient, it was also scalable. By relying on logical reasoning rather than hardcoding every possible scenario, I created a solution that could adapt to changes in the data or business requirements. Plus, it was easy to explain to stakeholders, which is always a win.</p><h3>Key Takeaways: How to Use Logic Like a Pro</h3><ol><li><strong>Start with First Principles</strong>: Break down the problem to its core. Ask yourself: What’s the simplest, most fundamental logic that applies here?</li></ol><p><strong>2. Avoid Overcomplicating</strong>: Sometimes, the most elegant solution is the simplest one. Don’t overthink it</p><p><strong>3. Test Your Assumptions</strong>: Always question your logic. Are there edge cases or exceptions you haven’t considered?</p><p><strong>4. Communicate Clearly</strong>: Logic isn’t just for solving problems, it’s also for explaining your solutions. Make sure your reasoning is clear and easy to follow.</p><p>Logic isn’t just a tool, it’s a mindset. It’s what allows you to navigate the messy, unpredictable world of data and emerge with insights that matter. In the case of the invest-tech app, logic helped me define and measure key metrics accurately, providing the business with actionable insights.</p><p>So, the next time you’re faced with a tricky analysis, remember <strong>think logically, act decisively, and let the data tell its story</strong>. And who knows? You might just uncover the next big insight that transforms the business.</p><p>Happy analyzing, and may the logic be with you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eea40e8b235a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>