Foundations › Power BI › The bridge: Excel, SQL and Power BI
🌉 The bridge: Excel, SQL and Power BIThe Bridge from Excel and SQL to Power BI
VLOOKUP, SUMIFS, GROUP BY and pivot tables, and how each is written in Power BI and DAX.
The tools change, the analytical logic stays the same: a clear question, trusted data, a correct calculation, an interpretation, then a decision. This table shows the same idea written in Excel, SQL, Power BI and Python.
-- Model view: FactSales[ProductID] → DimProduct[ProductID]
Product = RELATED(DimProduct[Product])In Power BI you define the relationship once and every visual benefits, with no lookup repeated per row.
Home Sales = CALCULATE([Total Sales], DimProduct[Category] = "Home")CALCULATE is the stronger SUMIFS: it changes context for any measure, not just sums.
Rows: DimProduct[Category]
Columns: DimDate[Year]
Values: [Total Sales]The Matrix is the pivot table, but its values are DAX measures evaluated per context.
Axis: DimCustomer[City]
Values: [Total Sales]What you place on the axis is the GROUP BY; the measure is the aggregate function.
Sales 2025 = CALCULATE([Total Sales], DimDate[Year] = 2025)The filter can sit on the page in the user's hands (Slicer) or inside the measure.
-- Power Query: Home ▸ Merge Queries
-- or Model view relationship (preferred for analysis)Merge physically combines tables. A relationship keeps them separate and passes filters, ideal for a star schema.
Band = SWITCH(TRUE(), [Margin %] < 0.2, "Low", [Margin %] < 0.3, "Mid", "High")SWITCH(TRUE(), ...) is a clean alternative to nested IFs.
Customers = DISTINCTCOUNT(FactSales[CustomerID])Same idea, but it responds to visual filters.
VAR ly = CALCULATE([Total Sales], SAMEPERIODLASTYEAR(DimDate[Date]))
RETURN DIVIDE([Total Sales] - ly, ly)In SQL you write a window or self-join. In DAX: a sound date table plus SAMEPERIODLASTYEAR.
-- Home ▸ Get data ▸ Excel workbook ▸ Transform dataCleaning steps are recorded and replayed on every Refresh instead of monthly copy-paste.
Gross Profit = SUMX(FactSales, FactSales[Quantity] * (FactSales[UnitPrice] - FactSales[UnitCost]))If the result will be aggregated, a measure with SUMX beats a calculated column that bloats the model.
# Python: df.merge(products).groupby('Category')['Sales'].sum()
-- Power BI: relationship + Matrix by CategoryPython is great for automation and advanced analysis; Power BI for the model and the interactive decision dashboard.
Need a real Power BI dashboard for your business?
I design a data model and an executive dashboard fitted to your business and your real data.