Select Page

25 Days of DAX Challenges: My Journey & Key Learnings

Ever wondered how to get better with DAX? I started 25 days challenge to push my DAX limits, and I’d love to share my experiences and the key learnings I took away from it.

The Setup

I found a website which has a series of DAX Challenges. Every day, there is set a different DAX question to solve, focused on various aspects of Power BI and DAX. From basic aggregate functions to complex problem-solving, the journey was enlightening. Let’s dive into my daily challenges!

Highlighting Some Frequently Used Functions:

1.CALCULATE():

Description: Evaluates an expression in a context altered by specific filters. Owing to its flexibility, it’s a frequent go-to.

Syntax:

CALCULATE(<expression>, <filter1>, <filter2>, …)

Example:

CALCULATE(SUM(‘Sales'[Revenue]), ‘Sales'[Category] = “Electronics”)

2.FILTER():

Description: Returns a table filtered based on a given condition.

Syntax:

FILTER(<table>, <expression>)

Example:

FILTER(‘Products’, ‘Products'[Price] > 100)

3.SUMMARIZE():

Description: Crafts a summary table detailing the desired totals across specified groups.

Syntax:

SUMMARIZE(<table>, <groupby_column1>, … , <name>, <expression>, …)

Example:

SUMMARIZE(‘Sales’, ‘Sales'[Product], “Total Revenue”, SUM(‘Sales'[Revenue]))

4.AVERAGE() & AVERAGEX():

Description: While AVERAGE() calculates the arithmetic mean of values, AVERAGEX() assesses an expression for each table row and then derives the average.

4.1.Syntax:

AVERAGE(<column>)

Example:

AVERAGE(‘Products'[Price])

4.2.Syntax:

AVERAGEX(<table>, <expression>)

Example:

AVERAGEX(‘Sales’, ‘Sales'[Quantity] * ‘Sales'[Price])

5.VAR:

Description: Enables the storage of an expression’s result as a named variable for future use in other formulas.

Syntax:

VAR <name> = <expression>

Example:

ReturnCal =

VAR AveragePrice = AVERAGE(‘Products'[Price])

RETURN

AveragePrice * 1.10