Introduction to DAX
AS
Aman Saurav
10 min read
#dax
#data-modeling
DAX (Data Analysis Expressions) is the formula language behind PowerBI. It resembles Excel formulas but is designed to work with relational data and perform dynamic aggregation.
Measures vs. Calculated Columns
- Calculated Columns: Computed row-by-row and stored in the database. Good for static categorization (e.g.,
FullName = [FirstName] & " " & [LastName]). - Measures: Computed on the fly based on user filters and slicers. Good for aggregation (e.g.,
Total Sales = SUM(Sales[Amount])).
Basic Functions
CALCULATE(): The most important function in DAX. It modifies the filter context.Red Sales = CALCULATE(SUM(Sales[Amount]), Product[Color] = "Red")RELATED(): Fetches a value from a related table (like VLOOKUP).FILTER(): Returns a table representing a subset of another table or expression.
Mastering CALCULATE is the key to unlocking the true power of Power BI.