Power BI DAX Functions with Examples

Data Analysis Expressions (DAX) is the formula language that you can use to do calculations in Microsoft Power BI. It helps transform raw data into meaningful insights through a collection of functions, operators, and constants.

DAX contains over 250 functions designed specifically for business intelligence, allowing users to create complex calculations that would be difficult or impossible with regular spreadsheet formulas.

These functions range from simple mathematical operations to time intelligence and filter manipulations. You should learn these DAX functions even if you are new to Power BI or an expert in Power BI.

In this tutorial, I will explain DAX functions in Power BI and show you various examples of using them. This will help you implement them in Power BI projects.

What is DAX in Power BI?

DAX (Data Analysis Expressions) is a formula language explicitly designed for data analysis in Power BI, Excel Power Pivot, and SQL Server Analysis Services. It helps users create custom calculations in tables, columns, and measures.

Data Analysis Expressions (DAX) provides the foundation for data analysis in Power BI. This formula language helps users create custom calculations, manipulate data, and build advanced analytical models.

Unlike traditional spreadsheet formulas, DAX works with relational data models. This means it can analyze data across multiple related tables in Power BI.

DAX formulas can range from simple calculations to complex expressions that handle time intelligence, filtering, and statistical analysis. The language includes over 250 functions for various operations in Power BI.

Power BI professionals use DAX to transform raw data into meaningful business insights. It allows you to create calculated columns that store results within a table or measures that calculate results dynamically based on user interactions.

Check out Filter Power BI Dax Based On Condition

Key Concepts in Power BI DAX

Context is fundamental to understanding DAX. Filter context determines which data subset your formula works with, while row context identifies the current row during calculations.

Tables and columns form the basic structure in DAX. Unlike Excel, DAX operates on entire columns of data rather than individual cells.

Measures are dynamic calculations that update automatically based on user selections and filters in Power BI reports.

DAX includes specialized functions for:

  • Time intelligence (comparing periods)
  • Statistical analysis
  • Text manipulation
  • Logical operations

Calculated Columns Store results in the data model, adding new fields to tables. At the same time, Measures perform calculations dynamically and do not store data, making them more efficient.

Relationships between tables allow formulas to access data across multiple tables in Power BI.

Read Power BI Dax Filter

DAX Syntax Fundamentals

DAX formulas always begin with an equals sign (=) followed by a function or expression. The basic syntax is straightforward but powerful.

The below screenshot represents an example of a DAX Syntax. Using this example, you can understand how to use the DAX syntax properly.

IncomeTaxRates2025 = SUM(IncomeTaxRates[NetwageEarningsAfterTax]) * 5.05
power bi dax functions list with examples
  1. IncomeTaxRates2025: This is the name of the new measure being created. It will store the calculated value based on the formula.
  2. =: The equal sign represents the beginning of the DAX formula, indicating that the right-hand side expression will compute a value for the left-hand side (measure name).
  3. SUM: This DAX function sums up all values in the specified column.
  4. IncomeTaxRates: This is the table’s name that contains the column from which values are being summed.
  5. NetwageEarningsAfterTax: This column from the IncomeTaxRates table holds the values to be summed.
  6. *: This is the multiplication operator, which multiplies the sum of NetwageEarningsAfterTax by a constant factor (5.05).
  7. 5.05: This is a constant multiplier applied to the sum of NetwageEarningsAfterTax.

Function calls use parentheses and commas to separate arguments:

=SUM(Sales[Amount])

DAX uses square brackets to reference columns and single quotes for table names with spaces:

=AVERAGE('Sales Data'[Revenue])

Operators in DAX include arithmetic (+, -, *, /), comparison (=, >, <), and logical (&&, ||) types. These can be combined with functions to create complex formulas.

Variables can be defined using the VAR keyword to simplify complex calculations:

VAR TotalSales = SUM(Sales[Amount])
RETURN TotalSales * 0.15

Context transition occurs when row context needs to be transformed into filter context, often using the CALCULATE function.

Check out Power BI DAX Filter If

Core DAX Functions in Power BI

DAX (Data Analysis Expressions) provides powerful functions for creating calculations in Power BI, Power Pivot, and Analysis Services. These functions help transform raw data into meaningful insights through formulas ranging from simple arithmetic to complex conditional logic.

Logical Functions in Power BI

Logical functions in DAX help you create conditions and make decisions based on your data values. The most commonly used logical function is IF, which evaluates a condition and returns one value if the condition is true and another if it’s false.

IF(<condition>, <true-value>, <false-value>)

For example:

I have an Excel File formatted as a table called sales, if you want, you can download:

dax functions in power bi
StatusCategory = IF(Sales[Amount] > 1000, "High", "Low")

The DAX expression checks if the Amount in the Sales table is greater than 1000; if true, it assigns “High,” otherwise, it assigns “Low.” Here is the output you can see in the screenshot below.

Logical Functions in Power BI

Other logical functions in Power BI include AND, OR, and NOT, which let you combine multiple conditions. These functions are particularly useful in data modeling when you need to filter or categorize data based on specific criteria.

FunctionPurposeExample
IFReturns different values based on conditionsIF(Sales > 1000, “High”, “Low”)
ANDReturns TRUE if all conditions are trueIF(AND(Price > 100, Quantity > 20), “Premium”, “Standard”)
ORReturns TRUE if any condition is trueIF(OR(Category = “Books”, Category = “Electronics”), “Featured”, “Regular”)
NOTReverses a logical valueIF(NOT(InStock), “Order More”, “Sufficient”)

Check out Remove Filter From Power BI DAX

Mathematical and Statistical Functions in Power BI

Mathematical and statistical functions form the backbone of data analysis in Power BI. SUM, one of the most basic functions, adds all numbers in a column.

TotalSales = SUM(Sales[Amount])

The DAX expression calculates the total sum of all values in the Amount column from the Sales table. Then you can use this to calculate the column in your visual.

You can see the exact output in the screenshot below.

power bi dax examples

AVERAGE calculates the arithmetic mean, while MIN and MAX find the smallest and largest values in a column. These functions help identify trends and outliers in your datasets.

For more complex analyses, DAX offers statistical functions like COUNT, which counts non-empty cells in a column, and COUNTROWS, which counts rows in a table.

FunctionPurposeExample
SUMAdds all numbers in a columnSUM(Sales[Amount])
AVERAGECalculates arithmetic meanAVERAGE(Product[Price])
MIN/MAXFinds smallest/largest valuesMIN(Orders[DeliveryTime])
COUNTCounts non-empty cellsCOUNT(Customer[Email])
COUNTROWSCounts table rowsCOUNTROWS(Sales)

Text Functions in Power BI

Text functions manipulate string data in your Power BI reports. CONCATENATE joins two or more text strings into one string, which is useful for creating full names or complete addresses.

For example:

I have an Excel File formatted as a table called Customers, if you want, you can download:

You can see the output in the screenshot below:

dax functions in power bi with examples
FullName = Customers[FirstName] & " " & Customers[LastName]

Note:

The CONCATENATE function in DAX only accepts two arguments at a time. A better approach would be to use the & operator.

The DAX expression combines the FirstName and LastName columns from the Customers table with a space in between to create a full name. Here is the exact output in the screenshot below:

dax function in power bi

FIND and SEARCH help locate text within strings, while LEFT, RIGHT, and MID extract portions of text. LEN returns the number of characters in a text string in Power BI.

Text transformation functions like UPPER and LOWER change the case of text, while REPLACE substitutes specific characters in a string.

FunctionPurposeExample
CONCATENATEJoins text stringsCONCATENATE(FirstName, ” “, LastName)
FIND/SEARCHLocates text in a stringFIND(“@”, Email)
LEFT/RIGHTExtracts characters from start/endLEFT(ProductCode, 3)
UPPER/LOWERChanges text caseUPPER(Category)
REPLACESubstitutes textREPLACE(PhoneNumber, 1, 3, “(123)”)

Check out Power bi Dax Today() Function

Date and Time Functions in Power BI

Date and time functions are crucial for time-based analysis in Power BI. The DATE function creates a date from year, month, and day values. CALENDAR generates a table of dates within a specified range.

DateTable = CALENDAR(DATE(2025, 1, 1), DATE(2025, 12, 31))

The DAX expression creates a table named DateTable that contains a continuous list of dates from January 1, 2025, to December 31, 2025. Here is the exact output in the screenshot below:

dax functions in power bi

DAY, MONTH, and YEAR extract specific components from dates. Time intelligence functions like YEAR-TO-DATE and SAMEPERIODLASTYEAR allow for comparing performance across time periods in Power BI.

DATEADD and DATESBETWEEN help with date arithmetic and range calculations. QUARTER and WEEKNUM identify specific periods within a year.

FunctionPurposeExample
DATECreates a date valueDATE(2025, 4, 15)
CALENDARGenerates a table of datesCALENDAR(DATE(2025,1,1), DATE(2025,12,31))
DATEADDShifts a date by specified intervalDATEADD(Dates[Date], -1, MONTH)
SAMEPERIODLASTYEARReturns dates from previous yearSAMEPERIODLASTYEAR(Dates[Date])
WEEKNUM/QUARTERIdentifies week/quarter of a dateQUARTER(Orders[OrderDate])

Check out How to Use DATEDIFF() in Power BI DAX

Advanced DAX Functions for Data Analysis in Power BI

Now, let me show you some advanced DAX functions for data analysis in Power BI. You can use these functions for filtering, time-based analysis, and context-aware calculations.

Filtering Functions in Power BI

Filtering functions in DAX help you analyze specific segments of your data by creating calculated columns and measures that respond to user selections. The FILTER function is essential for applying complex conditions to your data tables.

To test the FILTER function, use this Excel file: Download Sales_Data_2025.xlsx. You can download and use this file.

Sales_in_2025 = CALCULATE(SUM(Sales[Amount]), FILTER(Sales, Sales[Year] = 2025))

Here is the exact output in the screenshot below:

Filtering Functions in Power BI

The DAX expression calculates the total sales amount for the year 2025 by applying a filter on the Sales table.

The ALL function removes filters from a table or column, providing a way to create comparisons against total values. For percentage calculations, this is particularly useful:

You can download this Excel file to test the Market_Share DAX expression: Download US_Product_Sales.xlsx. You can use this file for practices.

Market_Share = DIVIDE(SUM(Sales[Amount]), CALCULATE(SUM(Sales[Amount]), ALL(Sales[Product])))

Here is the exact output in the screenshot below:

Advanced DAX for Data Analysis in Power BI

Other important filtering functions include VALUES and DISTINCT for returning unique values, and ALLNOBLANKROW which behaves like ALL but excludes blank rows. The RELATED and RELATEDTABLE functions let you access values from related tables when creating calculated columns.

Check out Power BI DAX Min Date

Time Intelligence Functions in Power BI

Time Intelligence functions help analyze data across different time periods, making trend analysis much easier in Power BI. These functions work with date tables to provide context-aware calculations.

You can download this Excel file to test the Prior_Year_Sales DAX expression: Download Prior_Year_Sales_Data.xlsx ​and use it.

DATEADD shifts a date range forward or backward by a specified interval:

Prior_Year_Sales = CALCULATE(SUM(Sales[Amount]), DATEADD(Calendar[Date], -1, YEAR))

Calculates the total sales amount for the same period in the previous year by shifting the Calendar[Date] column back by one year using the DATEADD function.

Here is the exact output in the screenshot below:

Time Intelligence Functions in Power BI

DATESBETWEEN creates a filter for dates within a specific range, while TOTALYTD calculates year-to-date totals:

YTD_Sales = TOTALYTD(SUM(Sales[Amount]), Calendar[Date])

Calculates the Year-To-Date (YTD) Sales, summing the Amount column in the Sales table from the beginning of the year up to the given date in the Calendar[Date] column.

The exact output is in the screenshot below.

Time Intelligence Functions in Power BI

SAMEPERIODLASTYEAR is perfect for comparing current performance against the previous year. These functions require a properly configured date table with continuous dates and appropriate relationships to your fact tables.

Check out Filter Last N Days Data Using Power BI DAX

Information Functions in Power BI DAX

Information functions help manage data quality issues and error handling in your DAX calculations. They’re essential to create measures that won’t break when encountering problematic data.

ISBLANK checks if a value is blank, while ISERROR detects calculation errors:

Safe_Division = IF(ISBLANK([Denominator]) || [Denominator] = 0, 0, [Numerator]/[Denominator])

The IFERROR function provides an elegant way to handle errors by substituting alternative values:

Protected_Calculation = IFERROR([Risky_Calculation], 0)

These functions are particularly valuable when working with complex calculations or data from external sources where quality might vary. They help prevent dashboard errors that could undermine user confidence in your reports.

Check out Filter Current Year Data Using Power BI DAX

Create Calculations in Power BI DAX

DAX provides powerful calculation capabilities in Power BI that transform raw data into meaningful insights. Users can create different types of calculations to analyze data in various contexts and achieve precise results based on business requirements.

Calculated Columns Vs. Measures

Calculated columns and measures serve different purposes in Power BI. Calculated columns are computed once when data refreshes and store a value for each row in a table. They work well for row-by-row calculations.

Calculated Column Example:

Full Name = Table[First Name] & " " & Table[Last Name]

Measures, on the other hand, are dynamic calculations that respond to user interactions in reports. They recalculate when filters change and don’t store values in the data model.

Measure Example:

Total Sales = SUM(Sales[Amount])

The key difference lies in performance and memory usage. Calculated columns consume storage space while measures use less memory since they compute only when needed.

Using CALCULATE Function

The CALCULATE function is one of the most important DAX functions in Power BI. It evaluates an expression in a modified filter context.

Basic Syntax:

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

This function lets you override existing filters or add new ones. For example, to find sales for a specific region:

You can download this Excel file to test the West Region Sales DAX expression: Download West_Region_Sales_Data.xlsx

West Region Sales = CALCULATE(SUM(Sales[Amount]), Sales[Region]="West")

Calculates the total sales amount specifically for the West region by applying a filter to the Sales[Region] column.

power bi dax functions list

CALCULATE works with many other filter functions like FILTER, ALL, and ALLEXCEPT. These combinations create powerful expressions that can answer complex business questions.

The function is especially useful for time intelligence calculations like year-to-date or month-over-month comparisons.

Context and Aggregation

DAX operates using two main types of context: row context and filter context. Understanding these concepts is essential for creating accurate calculations.

Row context refers to the current row during iteration functions like SUMX, AVERAGEX, and COUNTX. These X-functions apply calculations to each row before aggregating results.

Total Profit = SUMX(Sales, Sales[Quantity] * (Sales[Price] - Sales[Cost]))

Filter context determines which data subset is included in calculations. It changes when users interact with slicers, filters, or other visuals in reports.

Aggregation functions like SUM, AVERAGE, and COUNT depend entirely on the current filter context. This behavior allows measures to show different results as users explore data from various angles.

Read How to Filter Date Using Power BI DAX

Data Modeling with DAX in Power BI

Data modeling in Power BI becomes powerful when combined with DAX functions. When you build relationships between tables and create calculated tables, you open up new possibilities for analysis that go beyond basic reporting.

Understanding Data Relationships

Relationships form the backbone of any effective Power BI data model. They connect tables together, allowing you to analyze data across different dimensions without complex lookups.

In Power BI, you can establish relationships between tables that share common fields. For example, a Sales table might connect to a Products table through a ProductID field. This connection lets you analyze sales by product category without merging tables.

DAX functions like RELATED() and RELATEDTABLE() leverage these relationships. The RELATED function retrieves values from another table when a relationship exists. For instance:

TotalSales = SUM(Sales[Amount])

When placed in the Products table, this measure automatically calculates sales for each product using the established relationship.

Creating Calculated Tables

Calculated tables in Power BI are generated using DAX formulas rather than imported directly from a data source. They become part of your data model and refresh when the model updates.

To create a calculated table, you use the TABLE function along with other DAX functions. For example:

I have created the Excel file containing the Customers table: Download Customers_TopCustomers.xlsx

dax functions in power bi with examples
Top Customers = 
FILTER(
    Customers,
    Customers[TotalPurchases] > 10000
)

This DAX expression creates a calculated table in Power BI that filters the Customers table and returns only the rows where the TotalPurchases value is greater than 10,000.

Power BI - How to Create Calculated Tables

This creates a new table containing only high-value customers.

Calculated tables are useful for scenarios like date dimensions, categorization tables, and specialized aggregations. They allow you to extend your data model without modifying source data.

Unlike Power Query transformations which happen before loading data, calculated tables operate within the loaded data model and can reference other model objects.

Read Filter Distinct Date Using Power BI DAX

Optimize DAX for Performance

DAX optimization is critical for faster report loading times and better user experience in Power BI. Well-structured DAX formulas can dramatically reduce calculation time, especially when dealing with large datasets.

Best Practices for Efficient DAX

In Power BI, choose measures over calculated columns whenever possible. Measures calculate only when needed, while calculated columns process every row in your table.

Use variables to prevent multiple calculations of the same expression:

// More efficient with variable
VAR CurrentYearSales = SUM(Sales[Amount])
RETURN
IF(CurrentYearSales > 0, CurrentYearSales * 0.1, 0)

Filter early in your calculations to reduce the data volume being processed. Let the engine work with smaller datasets before applying complex logic.

Keep your data model clean. Remove unnecessary columns and create appropriate relationships between tables to help the DAX engine create efficient query plans.

Use CALCULATETABLE instead of FILTER when working with large tables in Analysis Services and Power BI.

Performance Tuning Techniques

Monitor query performance using DAX Studio or Performance Analyzer in Power BI. These tools help identify slow-running calculations.

Replace CALCULATE + FILTER with direct filter expressions when possible:

// Less efficient
CALCULATE(SUM(Sales[Amount]), FILTER(Dates, Dates[Year] = 2024))

// More efficient
CALCULATE(SUM(Sales[Amount]), Dates[Year] = 2024)

For complex calculations, break down logic into smaller measures. This improves readability and often allows the engine to optimize each part better.

Avoid iterating functions (SUMX, AVERAGEX) on large tables when simpler aggregations would work. In Excel and Power BI, these functions require row-by-row calculation.

Use time intelligence functions like SAMEPERIODLASTYEAR instead of complex date filters to get better performance with date-related calculations.

Check out Switch in DAX

Power BI DAX Real-world Examples and Use Cases

DAX functions transform raw data into valuable business intelligence. The following examples showcase how specific DAX functions solve common business challenges in sales, inventory, and customer analysis.

I’ve created the Excel file with sample data for sales, inventory, and customer analytics. You can download it here: Download DAX_Sample_Data.xlsx

Sales Insights

Sales analysis becomes much more powerful with DAX functions. For example, the CALCULATE function helps compare current sales with previous periods:

Sales by Category = 
CALCULATE(SUM(Sales[SalesAmount]), ALLEXCEPT(Sales, Sales[ProductCategory]))

Here is the exact output in the screenshot below:

power bi dax functions list with examples

This formula instantly shows year-over-year growth percentages across different product categories or regions.

For sales team performance tracking, the RANKX function is invaluable:

Sales Rep Ranking = 
RANKX(ALL(Sales[SalesRep]), [Total Sales],, DESC)

You can see the exact output in the screenshot below:

dax power bi

This ranks each salesperson based on their total sales performance.

The SUMMARIZE function can create quick sales breakdowns by product and region:

Sales Summary = 
SUMMARIZE(
    Sales, 
    Sales[ProductCategory], 
    Sales[Region], 
    "Total Sales", SUM(Sales[SalesAmount])
)

You can see the exact output in the screenshot below:

dax examples in power bi

This grouped view helps identify top-performing products and regions at a glance.

Inventory Management

Effective inventory management relies on accurate stock calculations. Using COUNTROWS with Filter functions helps identify potential stockouts:

Low Stock Items = 
COUNTROWS(
    FILTER(Inventory, 
    Inventory[Stock Level] < Inventory[Reorder Point])
)

You can see the exact output in the screenshot below:

power bi dax functions with examples

This measure immediately flags items needing attention.

For calculating days of inventory remaining, AVERAGEX proves useful:

Avg Sales per Product = 
AVERAGEX(
    VALUES(Inventory[ProductName]), 
    CALCULATE(SUM(Sales[SalesAmount]))
)
understanding dax in power bi

This helps managers prioritize ordering decisions.

Inventory turnover analysis becomes clearer with GROUPBY functions:

StockValueByCategory = 
GROUPBY(
    Inventory,
    Inventory[Category],
    "Total Stock Value", SUMX(CURRENTGROUP(), Inventory[StockLevel] * Inventory[COGS])
)
dax function in power bi

This metric shows which product categories move quickly and which tend to sit in warehouses.

Customer Analytics

Customer segmentation becomes powerful with DAX. The DISTINCTCOUNT function helps identify high-value customers:

FrequentBuyersByAgeGroup = 
CALCULATE(
    DISTINCTCOUNT(Customers[CustomerID]), 
    Customers[TotalPurchases] > 15,
    ALLEXCEPT(Customers, Customers[AgeGroup])
)

Here is the exact output in the screenshot below:

What is Count Distinct in Power BI and How Do I Use it

This measure shows what percentage of revenue comes from the top 10 customers.

RELATEDTABLE functions connect customer demographics with purchase behavior:

The RELATEDTABLE function in DAX is useful when working with one-to-many relationships between tables. It returns a table containing all rows related to the current row from another table.

AvgLifetimeValue = AVERAGEX(RELATEDTABLE(Customers), Customers[LifetimeValue])

You can see the exact output in the screenshot below:

Calculate the Average Lifetime Value Per Age Group in Power BI

For analyzing repeat purchases, INTERSECT functions help identify loyal customers:

The INTERSECT function in DAX is proper when finding common values between two tables or columns. Since your dataset includes Customer Data and Inventory Data, let’s explore some relevant INTERSECT examples.

We can identify products that are low on stock and have high cost of goods sold (COGS).

CommonProducts = 
INTERSECT(
    FILTER(Inventory, Inventory[StockLevel] < Inventory[ReorderPoint]),
    FILTER(Inventory, Inventory[COGS] > 200)
)
Power BI DAX Function with Examples

This measure counts customers who purchased both this year and last year, providing insights into customer retention.

Conclusion

DAX functions are very useful in Power BI for data analysis and visualization. They transform raw data into valuable insights that drive better business decisions. With over 250 functions available, DAX offers everything from basic aggregations to complex statistical calculations.

I hope this tutorial helps you in learning DAX functions with examples.

You may also like:

1 thought on “Power BI DAX Functions with Examples”

Leave a Comment

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Live Webinar

Quiz App Using SharePoint Framework (SPFx)

Learn to built a complete Quiz Management solution that enables admins to create and manage quizzes, categories, questions, and settings with an easy automated setup process in SharePoint. It also includes an interactive quiz experience for users and a powerful dashboard to track participation, analyze results, and view detailed performance reports with charts and answer insights.

📅 2nd June 2026 – 10:00 AM EST | 7:30 PM IST

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App