DEV Community

samwel
samwel

Posted on

Everything I Learned About Power BI From Zero to Actually Understanding DAX

What Even Is Power BI?
Power BI is a data visualization and business intelligence tool by Microsoft. You use it to connect to data, clean it, analyze it, and build dashboards and reports.
Power Query
Before you can analyze anything, your data needs to be clean. Power Query is the tool inside Power BI where you do all that cleaning

DAX-Data Analysis Expressions
The Formula Language of Power BI

Measures vs Calculated Columns
A calculated column adds a new column to your table. It calculates a value per row and stores it there permanently

A Measure calculates a single value on the fly based on whatever filters are currently applied
SUM vs SUMX
SUM **just adds up values in a single existing column. **SUMX goes row by row, does a calculation per row, then adds all the results together.

  1. Math Functions ABS-Absolute Value ABS removes the negative sign and always returns a positive number

ROUND, ROUNDUP, ROUNDDOWN
ROUND goes to nearest. ROUNDUP always goes up. ROUNDDOWN always goes down.

MOD
Remainder After Division-MOD gives you the leftover after dividing two numbers. Most common use is checking even or odd numbers.

Text Functions
CONCATENATE and the & Operator
CONCATENATE joins two text values but only takes two arguments. The & operator has no limit and is cleaner.

LEFT, RIGHT, MID
LEFT extracts from the start. RIGHT extracts from the end. MID extracts from the middle.
Logical Functions
IF
IF always needs exactly three parts separated by commas the condition, result if true, result if false.

AND, OR, &&, ||
AND and OR only accept two conditions. Use && and || when you need more than two

SWITCH(TRUE())
SWITCH is cleaner than nested IFs. SWITCH(TRUE()) lets you use conditions inside SWITCH

ISBLANK
ISBLANK checks if a cell is truly empty — not zero, but empty. Blank is NOT the same as zero.

CALCULATEThe Most Powerful DAX Function
CALCULATE lets you calculate something with a filter applied

ALL, REMOVEFILTERS and ALLEXCEPT

ALL removes all filters and forces Power BI to look at the entire dataset even if a slicer is active. REMOVEFILTERS does the exact same thing with a clearer name.

ALLEXCEPT removes all filters except the ones you specify

Date Functions
TODAY() — Returns today's date
NOW() — Returns today's date and time
YEAR([Date]) — Extracts the year
MONTH([Date]) — Extracts the month number
DAY([Date]) — Extracts the day number

COUNT vs COUNTA
COUNT only counts numeric values. COUNTA counts everything that is not blank numbers, text, dates.

Top comments (0)