You are currently viewing Top 20 DAX Functions in Power BI with Practical Examples | Master DAX Easily
Power BI DAX

Top 20 DAX Functions in Power BI with Practical Examples | Master DAX Easily

๐Ÿ” Mastering DAX in Power BI: Top 20 Essential Functions with Real-Life Examples

Power BI is a powerful tool for data visualization and business intelligence, but what truly sets it apart is DAX (Data Analysis Expressions)โ€”a formula language that empowers users to create custom calculations and unlock deeper insights.

Whether you’re building dashboards, tracking KPIs, or performing advanced analytics, these 20 essential DAX functions will elevate your Power BI skills from good to great. Letโ€™s dive into each function with real-world examples you can try today!

๐Ÿงฎ 1. SUM()

Purpose: Adds up all values in a column.
Syntax: SUM(column)

๐Ÿ“Œ Example:

DAX
TotalSales = SUM(Sales[UnitPrice] * Sales[Quantity])

Calculates the total revenue by multiplying unit price and quantity for each transaction.


๐Ÿ“Š 2. AVERAGE()

Purpose: Returns the average of values in a column.
Syntax: AVERAGE(column)

๐Ÿ“Œ Example:

DAX
AvgQuantity = AVERAGE(Sales[Quantity])

Finds the average quantity sold across all orders.


๐Ÿ”ป 3. MIN()

Purpose: Returns the smallest value.
Syntax: MIN(column)

๐Ÿ“Œ Example:

DAX
MinPrice = MIN(Sales[UnitPrice])

Finds the lowest price of products sold.


๐Ÿ”บ 4. MAX()

Purpose: Returns the largest value.
Syntax: MAX(column)

๐Ÿ“Œ Example:

DAX
MaxPrice = MAX(Sales[UnitPrice])

Finds the highest product price in the dataset.


๐Ÿงฎ 5. COUNT()

Purpose: Counts non-blank values.
Syntax: COUNT(column)

๐Ÿ“Œ Example:

DAX
TotalOrders = COUNT(Sales[OrderID])

Counts the number of transactions in the sales table.


๐Ÿ”ข 6. DISTINCTCOUNT()

Purpose: Counts unique values.
Syntax: DISTINCTCOUNT(column)

๐Ÿ“Œ Example:

DAX
UniqueProducts = DISTINCTCOUNT(Sales[Product])

Counts how many distinct products were sold.


๐Ÿง  7. CALCULATE()

Purpose: Changes the context of a calculation with filters.
Syntax: CALCULATE(expression, filters...)

๐Ÿ“Œ Example:

DAX
SalesWest = CALCULATE(SUM(Sales[UnitPrice] * Sales[Quantity]), Sales[Region] = "West")

Calculates total sales only for the “West” region.


๐Ÿงน 8. FILTER()

Purpose: Creates a table based on a condition.
Syntax: FILTER(table, condition)

๐Ÿ“Œ Example:

DAX
HighSales = CALCULATE(SUM(Sales[UnitPrice]), FILTER(Sales, Sales[Quantity] > 10))

Sums unit prices for transactions with quantity > 10.


๐Ÿšซ 9. ALL()

Purpose: Removes filters from a table/column.
Syntax: ALL(table | column)

๐Ÿ“Œ Example:

DAX
TotalSalesAll = CALCULATE(SUM(Sales[UnitPrice] * Sales[Quantity]), ALL(Sales))

Calculates grand total sales, ignoring all filters.


โž— 10. DIVIDE()

Purpose: Performs safe division.
Syntax: DIVIDE(numerator, denominator, [alternate result])

๐Ÿ“Œ Example:

DAX
ProfitMargin = DIVIDE(SUM(Sales[Profit]), SUM(Sales[UnitPrice]), 0)

Returns profit margin, replacing divide-by-zero with 0.


โœ… 11. IF()

Purpose: Conditional logic.
Syntax: IF(condition, valueIfTrue, valueIfFalse)

๐Ÿ“Œ Example:

DAX
SalesStatus = IF(SUM(Sales[Quantity]) > 100, "High", "Low")

Classifies sales performance based on quantity.


๐Ÿ”€ 12. SWITCH()

Purpose: Replaces multiple IF conditions.
Syntax: SWITCH(expression, value1, result1, ..., [default])

๐Ÿ“Œ Example:

DAX
RegionCategory = SWITCH(Sales[Region], "East", "A", "West", "B", "C")

Categorizes regions for grouping.


๐Ÿ—“๏ธ 13. DATEADD()

Purpose: Shifts dates forward or backward.
Syntax: DATEADD(date_column, number, interval)

๐Ÿ“Œ Example:

DAX
SalesLastYear = CALCULATE(SUM(Sales[UnitPrice] * Sales[Quantity]), DATEADD(Sales[Date], -1, YEAR))

Compares current sales with the same period last year.


๐Ÿ“… 14. TOTALYTD()

Purpose: Year-to-date calculation.
Syntax: TOTALYTD(expression, date_column)

๐Ÿ“Œ Example:

DAX
YTDSales = TOTALYTD(SUM(Sales[UnitPrice] * Sales[Quantity]), Sales[Date])

Displays cumulative sales for the year.


โณ 15. SAMEPERIODLASTYEAR()

Purpose: Pulls values from the same period a year earlier.
Syntax: SAMEPERIODLASTYEAR(date_column)

๐Ÿ“Œ Example:

DAX
LastYearSales = CALCULATE(SUM(Sales[UnitPrice] * Sales[Quantity]), SAMEPERIODLASTYEAR(Sales[Date]))

Useful for YoY comparisons.


๐Ÿ”— 16. RELATED()

Purpose: Fetches a value from a related table.
Syntax: RELATED(column)

๐Ÿ“Œ Example:

DAX
ProductCategory = RELATED(Products[Category])

Brings in category data from a related Products table.


๐Ÿ”ค 17. CONCATENATE()

Purpose: Joins two text strings.
Syntax: CONCATENATE(text1, text2)

๐Ÿ“Œ Example:

DAX
ProductRegion = CONCATENATE(Sales[Product], Sales[Region])

Generates labels like “LaptopWest”.


๐Ÿ† 18. RANKX()

Purpose: Assigns rank based on a metric.
Syntax: RANKX(table, expression, [value], [order])

๐Ÿ“Œ Example:

DAX
SalesRank = RANKX(ALL(Sales[Product]), SUM(Sales[UnitPrice] * Sales[Quantity]))

Ranks products by total revenue.


๐Ÿ•ณ๏ธ 19. BLANK()

Purpose: Returns a blank/null value.
Syntax: BLANK()

๐Ÿ“Œ Example:

DAX
AdjustedProfit = IF(SUM(Sales[Profit]) < 0, BLANK(), SUM(Sales[Profit]))

Avoids showing negative profits.


๐Ÿ” 20. EARLIER()

Purpose: Refers to an earlier row context.
Syntax: EARLIER(column)

๐Ÿ“Œ Example:

DAX
RankWithinRegion = CALCULATE( COUNTROWS(Sales), FILTER(Sales, Sales[Region] = EARLIER(Sales[Region]) && Sales[UnitPrice] > EARLIER(Sales[UnitPrice])) ) + 1

Ranks items within each region.

ย 


๐Ÿง  Final Thoughts

Mastering these top 20 DAX functions equips you to create more interactive, accurate, and insightful Power BI reports. From simple aggregations to dynamic time intelligence and ranking, these functions are your gateway to data-driven decision making.

ย 

๐Ÿ“Œ Pro Tip: Practice these examples with your own dataset to gain hands-on confidence. As you progress, combine multiple DAX functions for powerful custom logic.

๐Ÿ’ฌ Got a favorite DAX trick or question? Share it in the comments below!

Md. Manik Hossain Shimul

Md. Manik Hossain is a dynamic and results-driven corporate trainer, human development researcher, and HR professional with nearly 11 years of diversified experience across corporate training, organizational development, production and general management, executive coaching, and business analytics. A specialist in HR Analytics, Power BI, Microsoft Excel, and leadership development, Manik regularly conducts professional training programs on topics such as customer service excellence, negotiation skills, emotional intelligence, and communication mastery. His mission is to empower professionals with data-driven insights and human-centric strategies to drive organizational excellence. He is the founder and lead facilitator of multiple online and offline learning programs, including HR Analytics with Power BI & Excel, Advanced Excel for Business & Finance, Negotiation & Persuasion Mastery, and Effective Leadership & Team Building. A lifelong learner and passionate educator, Manik believes in creating meaningful impact through continuous learning, collaboration, and innovation.

Leave a Reply