Retail · Power BI
Connecting Power BI to a PostgreSQL retail database and configuring an 8-table star schema
Independent grading: 100/100(verify, opens in a new tab)
Problem
Nura Ibrahim, a stakeholder at Meridian Retail (simulated retailer), needed a visual analysis of a revenue discrepancy. Before any report could be built, the full transactional database had to be loaded into Power BI, covering orders, customers, products, categories, stores, inventory, and sessions across 8 tables.
What I did
Using Import mode, I connected Power BI Desktop to the Meridian PostgreSQL server and navigated each table through the retail schema using M code. Power BI auto-detected 9 relationships, which I reviewed against the expected star-schema structure: order_items linking to orders, orders linking to customers and stores, and products linking to categories. The sessions table presented an ambiguity, it linked to both customers and orders, so I set the sessions-to-orders relationship as inactive to avoid conflicting filter paths. The file was saved in PBIP format as instructed.
Finding
All 8 required tables loaded correctly with 9 relationships in place, matching the star-schema structure needed for revenue analysis.
Outcome
Nura had a fully connected data model ready for revenue visuals, with no broken relationships and no ambiguous filter paths that could distort aggregations.
let
Source = PostgreSQL.Database("ep-frosty-glade-ab4k8hyw-pooler.eu-west-2.aws.neon.tech", "meridian_retail"),
#"Navigation 1" = Source{[Schema = "retail", Item = "orders"]}[Data]
in
#"Navigation 1"This M code connects to the Meridian PostgreSQL database and navigates to the retail schema to load the orders table, the same pattern was applied to all 8 tables.
Next step
A useful next step would be to check whether the inactive sessions-to-orders relationship needs to be activated for session-level revenue analysis, and whether a USERELATIONSHIP measure is required to query that path.
- PostgreSQL connection via Power BI Import mode
- Power Query M code authoring
- Star-schema relationship configuration in Power BI
- Inactive relationship management to avoid ambiguous filter paths