DAX - Data Analysis Expressions

📊 DAX - Data Analysis Expressions

Master Power BI's 300+ Functions
🎓 Ghaziabad Mohan Nagar
👨‍💼 Designed by: HR Prateek Sharma

What is DAX?

DAX (Data Analysis Expressions) is a powerful set of functions and expressions that allows us to perform in-depth data analysis in Power BI.

While traditional Excel offers functions like SUM, AVG, MIN, MAX, SUMIF, COUNTIF, VLOOKUP, HLOOKUP, Power BI takes it to the next level with 300+ advanced functions for complex data analysis.

📈 Excel Functions

  • SUM
  • AVERAGE
  • MIN & MAX
  • SUMIF & COUNTIF
  • VLOOKUP & HLOOKUP

Power BI DAX

  • 300+ Functions
  • Complex Calculations
  • Time Intelligence
  • Advanced Filtering
  • Dynamic Analysis

🎯 Key Benefits

  • Real-time Analysis
  • Custom Measures
  • Calculated Columns
  • Dynamic Tables
  • Filter Context

DAX Components

1. Calculated Measure

Returns a single value for analysis and aggregation

2. Calculated Column

Returns a column in table view (Table Tools → New Column)

3. Calculated Table

Creates new tables based on expressions

4. Filter Expression

Applies criteria for filtering data

DAX Examples & Formulas

💰 Profit Remark (Conditional Logic)

profit remark = IF(order[profit] > 0, "profit", "loss")
// Checks if profit is positive or negative

🗺️ Filter by State

new york table = FILTER(Orders, Orders[State] = "new york")
// Creates a filtered table for New York state

📅 Date Dimension Table

date dim = CALENDAR(DATE(2014,01,01), DATE(2018,12,31))
// Creates a date table from 2014 to 2018

📆 Time Intelligence Functions

year no = YEAR('date dim'[Date])
month no = MONTH('date dim'[Date])
day no = DAY('date dim'[Date])
weekday = WEEKDAY('date dim'[Date])
weeknum = WEEKNUM('date dim'[Date])
Qtr no = QUARTER('date dim'[Date])

📝 Date Formatting

day name = FORMAT('date dim'[Date], "DDDD")
// Returns full day name (Monday, Tuesday, etc.)
month name = FORMAT('date dim'[Date], "MMMM")
// Returns full month name (January, February, etc.)

⏰ Date Difference Calculations

order age (negative) = DATEDIFF(TODAY(), 'date dim'[Date], YEAR)
// Shows negative result - calculates from today backwards
order age (positive) = DATEDIFF('date dim'[Date], TODAY(), YEAR)
// Shows positive result - calculates from date to today

🎓 Key Takeaways

✨ DAX transforms data analysis with 300+ powerful functions

✨ Create calculated measures, columns, and tables for dynamic insights

✨ Master time intelligence for date-based analysis

✨ Use filter expressions to analyze specific data segments

✨ Build complex business logic with conditional statements

Comments

Popular posts from this blog