← All projects

Customer and revenue dashboard

Power BI, DAX, PostgreSQL views · Report and SQL on GitHub

A two-page Power BI report on the Olist Brazilian e-commerce dataset: 99K+ orders, 96K customers and $16.0M in revenue. It extends my SQL analysis of the same data from static query results into a report that can be filtered by customer decile, state and date range.

Page 1: Revenue overview

The first page covers the headline numbers and how revenue moves over time.

Revenue overview page of the Power BI report: KPI cards, daily revenue and order trends, and revenue by customer decile.
Revenue overview, with KPI cards, daily trends and revenue by customer decile.
  • KPI cards for total revenue, unique customers, total orders and repeat-purchase rate.
  • Daily revenue and order trends. The November 2017 spike is driven by unusually high order volume, most likely Black Friday, and it is called out on the chart so it is not mistaken for growth.
  • Revenue concentration by lifetime-value decile: the top 10% of customers generate 38.5% of revenue.
  • Slicers for customer decile, customer state and date range filter every visual on the page.

Page 2: Retention and cohorts

The second page shows how few customers come back, and how long the ones who do take.

Retention and cohort page of the Power BI report: KPI cards, cohort heatmap, retention curve, purchase frequency and days to second purchase.
Cohort retention heatmap: first-purchase month by months since first purchase.
  • A cohort retention heatmap, with first-purchase month in the rows and months since first purchase in the columns.
  • A retention curve. Retention collapses after the first month, and most cohorts see under 0.5% of customers return in any later month.
  • Purchase frequency: the vast majority of customers order exactly once (repeat-purchase rate 3.12%).
  • Days to second purchase: median 39 days, mean 88 days. A long tail of slow returners pulls the mean well above the typical case, which is why both are shown.

How it's built

The processing happens in PostgreSQL views, so the logic is reusable and can be checked outside Power BI. Power BI handles the model, slicers and cross-filtering.

  • orders_enriched: one row per order payment, with customer, state, delivery days, a late flag and the order number for that customer.
  • customer_summary: one row per customer, with first purchase, orders, revenue, average order value, lifetime-value decile, repeat flag and days to second purchase.
  • cohort_table: cohort month by months since first purchase, with active customers and retention rate.

The Power BI model uses orders_enriched, customer_summary, cohort_table, a date table (Dim_Date) and geolocation. A DAX measure controls the heatmap colouring so that month 0, which is always 100%, does not wash out the differences between later months.

Limitations

  • The November 2017 spike is attributed to Black Friday because order volume rose sharply that month. I have not confirmed the cause.
  • The report shows how little customers return, not why. It is built on one public dataset covering 2016 to 2018.
  • The report reads from PostgreSQL views, so refreshing it means loading the Olist tables and creating the views first. The steps are in the repository.