⚡ DAX Query Basics – Data Types, Syntax & Functions
Last Updated: 15th October 2025
DAX (Data Analysis Expressions) is a formula language used in:
- Power BI
- Power Pivot (Excel)
- SSAS Tabular Models
It helps you create custom calculations — like totals, averages, growth rates, comparisons, etc.
🗣 Hinglish Tip: DAX ko samjho Excel formulas ka “Power BI version” — par zyada smart aur dynamic!
✏ DAX Syntax
DAX formula = Function Name + Arguments
NewColumn = FunctionName(TableName[ColumnName])
Example 👇
Total Sales = SUM(Sales[Amount])
💡 Syntax Breakdown:
SUM → Function name
( ) → Parentheses to enclose arguments
Sales[Amount] → TableName[ColumnName]
🧠 You can also create:
Calculated Columns → work row-by-row
Measures → work on aggregated data (dynamic)
-- Example of a Measure
Total Sales = SUM(Sales[Amount])
-- Example of a Calculated Column
Profit = Sales[Amount] - Sales[Cost]
🧩 DAX Data Types
DAX supports these core data types:
| Data Type | Description | Example |
|---|---|---|
| Whole Number | Integer values | 100, -45 |
| Decimal Number | Fractional values | 123.45, -10.5 |
| Currency | Fixed 4-decimal numeric (money) | ₹1000.2560 |
| Date/Time | Stores both date and time | 2025-10-16 09:30 |
| TRUE/FALSE | Boolean values | TRUE, FALSE |
| Text | String values | "Power BI", "India" |
| Blank | Represents empty or missing value | BLANK() |
🗣 Tip: DAX automatically converts data types when needed (called implicit conversion).
🔣 Writing DAX — General Syntax Rules
- Function names are not case-sensitive
- Always use square brackets [ ] for columns
- Use double quotes " " for text values
- Use comma (,) to separate function arguments
- Comments:
-- Single-line comment
/* Multi-line
comment */
🧮 Categories of DAX Functions
DAX has 250+ functions, but here are the main categories you’ll use daily:
| Category | Purpose | Example Function |
|---|---|---|
| Text | Manipulate string values | LEFT(), CONCATENATE(), LEN() |
| Date & Time | Work with date or time | TODAY(), YEAR(), DATEDIFF() |
| Aggregate | Summarize or total values | SUM(), AVERAGE(), COUNT() |
| Logical | Make decisions | IF(), AND(), OR(), SWITCH() |
| Time Intelligence | Compare periods (YTD, QTD, etc.) | TOTALYTD(), SAMEPERIODLASTYEAR() |
| Filter | Modify data context | CALCULATE(), FILTER(), ALL() |
| Table | Return or combine tables | SUMMARIZE(), UNION(), VALUES() |
| Statistical | Perform ranking or distribution | RANKX(), PERCENTILEX.INC() |
We will cover these in more detail in the coming sections.