Gomaa Intelligence.Data Hub
عربي

Foundations › Power BI › The bridge: Excel, SQL and Power BI

🌉 The bridge: Excel, SQL and Power BI

The 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.

VLOOKUP / XLOOKUPFetch the product name for every order
In Power BIRelationship + RELATED
-- 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.

SUMIFSTotal sales for one category
In Power BICALCULATE
Home Sales = CALCULATE([Total Sales], DimProduct[Category] = "Home")

CALCULATE is the stronger SUMIFS: it changes context for any measure, not just sums.

Pivot TableSales summary by category and year
In Power BIMatrix
Rows: DimProduct[Category]
Columns: DimDate[Year]
Values: [Total Sales]

The Matrix is the pivot table, but its values are DAX measures evaluated per context.

GROUP BYSales per city
In Power BIVisual axis + measure
Axis: DimCustomer[City]
Values: [Total Sales]

What you place on the axis is the GROUP BY; the measure is the aggregate function.

WHEREAnalyse 2025 only
In Power BISlicer or a filter in CALCULATE
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.

JOINLink orders to the products table
In Power BIMerge Queries or a relationship
-- 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.

IF / CASE WHENClassify the margin
In Power BISWITCH
Band = SWITCH(TRUE(), [Margin %] < 0.2, "Low", [Margin %] < 0.3, "Mid", "High")

SWITCH(TRUE(), ...) is a clean alternative to nested IFs.

COUNT DISTINCTNumber of distinct customers
In Power BIDISTINCTCOUNT
Customers = DISTINCTCOUNT(FactSales[CustomerID])

Same idea, but it responds to visual filters.

Window function (LAG / YoY)Growth vs the previous year
In Power BITime intelligence
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.

Excel Table / Named rangeA refreshable data table
In Power BIPower Query Query
-- Home ▸ Get data ▸ Excel workbook ▸ Transform data

Cleaning steps are recorded and replayed on every Refresh instead of monthly copy-paste.

Calculated cell (=B2*C2)Profit per row
In Power BICalculated column or SUMX
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.

pandas groupby + mergeThe same analysis in Python
In Power BIPower Query + DAX
# Python: df.merge(products).groupby('Category')['Sales'].sum()
-- Power BI: relationship + Matrix by Category

Python 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.

Request an analytics service ↗
Get your data analyzed by an expert ↗