Power BI DAX

CALCULATE function in Power BI DAX: Example and Tips

Copy-paste a Power BI DAX example for CALCULATE function and adapt it to your model.

💡 Ideas for You

Helpful resources matched to this page.

4 focused options
📚 Step-by-step booksIndependent learning resources and step-by-step books from Create & Learn.📘 Topic guideAmazon ideas related to CALCULATE function.🧮 Formula booksBooks and references for spreadsheet formulas and examples.⌨️ Productivity setupHelpful books, office tools, and productivity resources.

Quick answer

Use this DAX pattern as a starting point and rename the table, column, and measure references for your model.

Total Sales Filtered = CALCULATE([Total Sales], Sales[Region] = "East")

When to use it

Use CALCULATE function when the calculation belongs in a Power BI semantic model and needs to respond to slicers, filters, relationships, and report context.

Step-by-step

  1. Open Power BI Desktop and select the table where the measure should live.
  2. Create a new measure and paste the DAX example.
  3. Replace table and column names with your actual model names.
  4. Test the measure in a table visual before using it in cards or charts.
  5. Check the total row because DAX totals are calculated in their own filter context.

Excel comparison

The Excel equivalent is usually a worksheet formula or PivotTable calculation. Use DAX when the calculation should respond to report filters and relationships.

Common mistakes

  • Using a calculated column when a measure is better.
  • Ignoring filter context and expecting row-by-row Excel behavior.
  • Not having a proper date table for time intelligence formulas.
  • Using division without DIVIDE, which can create divide-by-zero errors.

Related DAX examples