DEV Community

samwel
samwel

Posted on

Fact Tables, Star Schemas, Joins and Dashboards

When I first heard the words star schema, fact table and DAX, I honestly had no idea what any of that meant. It sounded like something only data scientists with ten years of experience would understand. But here I am, a few classes in, and I can actually say I get it now.

*Flat Tables
The first thing I learned is that most data you get in the real world comes as one big flat table. Think of it like a school register where everything is on one sheet: student name, class, teacher name, subject, marks, county—all in one row.

Fact Tables and Dimension Tables
Simple rule : if a column has a number you would SUM or AVERAGE, it belongs in the fact table. If it is a description or label that repeats, it belongs in a dimension table.

Star Schema vs Snowflake Schema
Once you have split your flat table into fact and dimension tables, you have a star schema. The fact table sits in the middle; dimension tables surround it just like a star.

My instructor also introduced the snowflake schema, which is where dimension tables get split further into even smaller tables. I like to think of it this way:
A star schema is like keeping everything about a customer in one folder. Snowflake schema is like splitting that folder into sub-folders inside sub-folders.
For Power BI, stick with the star schema. It is simpler and faster.

Relationships — Connecting the Tables
After splitting your data into multiple tables, you need to connect them. That connection is called a relationship.

Every relationship works because two tables share a common column usually an ID. Like CustomerID appearing in both the Sales table and the Customer table. That shared column is the bridge.
The most common relationship is one-to-many (1:*) — one customer can have many purchases. One product can appear in many sales. In Power BI's model view, you just drag the shared column from one table to the other, and Power BI draws the line for you.
Once your relationships are set up, you can build charts using columns from different tables without manually joining anything. Power BI handles it behind the scenes.

Joins—Merge Queries in Power Query
Before I understood relationships, I was using Merge Queries to combine tables. Power BI gives you six join types:

Inner join — only rows that match in both tables
Left outer join — all rows from the left table, nulls where there is no match
Right outer join — all rows from the right table
Full outer join — every row from both tables
Left anti join — rows from the left table with NO match (great for finding missing data)
Right anti join — rows from the right table with NO match
The one that surprised me most was the anti join. I used it to find customers who had never made a purchase—you just put the Customers table on the left, Sales on the right, pick Left Anti, and boom—only the customers with no orders show up.
**
Charts and Dashboards**
After all the data modelling work, you finally get to build something visual.
Here is what I learned about each chart type:
Column and bar charts are for comparing categories. A column goes up and down, and a bar goes left and right. Use a bar when your category names are long; they have more room.

Line and Area charts are for showing trends over time. Always put your date on the X axis. An area chart is just a line chart with the space below filled in, good for showing volume.

_Pie and donut charts show proportions—parts of a whole. Keep it to five categories or less; otherwise, the slices become too small to read. A donut is the same thing with a hole in the middle where you can put a summary number.

A treemap is like a pie chart but uses rectangles. Better when you have many categories.

A funnel chart shows a step-by-step process where numbers drop off at each stage, like patients moving from diagnosis to treatment to discharge.

A combo chart combines a bar chart and a line chart in one visual. Useful when you are comparing two measures with very different scales.

The card is just one big number on the screen. I put these at the top of my dashboard total visits, total revenue, and average satisfaction score. Like a scoreboard.

My First Dashboard
The first dashboard I built was on Kenya crops data showing yield, profit, cost of production, and revenue broken down by county and season.

Top comments (0)