Skip to main content

Power Query (ETL)

5. Power Query — Data Transformation (ETL)​

Power Query is where you clean and transform data before it enters the model. It uses a language called M.

Common Transformations​

OperationWhat It DoesHow
Remove columnsDrop unnecessary columnsRight-click → Remove
Filter rowsRemove irrelevant rowsDropdown → filter conditions
Change data typeEnsure correct typesClick column header icon
Split columnSplit "John Smith" into "John" and "Smith"Right-click → Split by delimiter
Unpivot columnsConvert wide format to tall formatSelect columns → Unpivot
Merge queriesJOIN two tables (like SQL JOIN)Home → Merge Queries
Append queriesUNION two tables (stack rows)Home → Append Queries
Add custom columnCreate a new calculated columnAdd Column → Custom Column
Group ByAggregate dataHome → Group By
Replace valuesFind and replace in a columnRight-click → Replace Values

Merge vs Append​

OperationSQL EquivalentWhat It Does
MergeJOINCombines columns from two tables based on a matching key
AppendUNIONStacks rows from two tables with the same structure

🧠 Merge = side by side (columns add hote hain). Append = upar neeche (rows add hote hain). SQL ke JOIN vs UNION jaisa.


6. Visualization Best Practices in Power BI​

Chart Selection Guide​

ScenarioRecommended Visual
Single KPI numberCard or KPI visual
Compare categoriesBar/Column chart
Trend over timeLine chart
Part of wholeDonut/Pie (max 5 categories)
Geographic dataMap or Filled Map
Detailed dataTable or Matrix
Multiple KPIs + sparklinesMatrix with conditional formatting
Categories with hierarchyTreemap
Target vs ActualGauge or Bullet chart

Report Design Rules​

  1. KPI cards at the top — the first thing viewers see
  2. Consistent color palette — use 3-4 colors max
  3. Slicers on the left or top — filters should be accessible but not dominating
  4. Title every visual — descriptive, not generic ("Revenue by Region FY24" not just "Chart")
  5. Use bookmarks for multiple views within one report
  6. Enable drill-through for detailed analysis pages
  7. Phone layout — always create a mobile-friendly version

7. Row Level Security (RLS)​

RLS restricts data access based on the logged-in user. For example, a regional manager sees only their region's data.

-- DAX filter for RLS role:
[Region] = USERPRINCIPALNAME()
-- Or static role: [Region] = "North"

Steps:

  1. Define roles in Power BI Desktop (Modeling → Manage Roles)
  2. Add DAX filters to each role
  3. Assign users to roles in Power BI Service