⚡ 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 TypeDescriptionExample
Whole NumberInteger values100, -45
Decimal NumberFractional values123.45, -10.5
CurrencyFixed 4-decimal numeric (money)₹1000.2560
Date/TimeStores both date and time2025-10-16 09:30
TRUE/FALSEBoolean valuesTRUE, FALSE
TextString values"Power BI", "India"
BlankRepresents empty or missing valueBLANK()

🗣 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:

CategoryPurposeExample Function
TextManipulate string valuesLEFT(), CONCATENATE(), LEN()
Date & TimeWork with date or timeTODAY(), YEAR(), DATEDIFF()
AggregateSummarize or total valuesSUM(), AVERAGE(), COUNT()
LogicalMake decisionsIF(), AND(), OR(), SWITCH()
Time IntelligenceCompare periods (YTD, QTD, etc.)TOTALYTD(), SAMEPERIODLASTYEAR()
FilterModify data contextCALCULATE(), FILTER(), ALL()
TableReturn or combine tablesSUMMARIZE(), UNION(), VALUES()
StatisticalPerform ranking or distributionRANKX(), PERCENTILEX.INC()

We will cover these in more detail in the coming sections.