Data Analysis Expression (DAX) language is integral in Power Pivot, Power BI, and Analysis Services in Microsoft Excel. These DAX formulas combine operators, functions, and values to execute complex calculations and data queries in tabular models.

CALCULATE is one of the most important DAX functions to simplify scenarios with custom data filters.

DAX CALCULATE Step-by-step

DAX CALCULATE Step-by-step

Imagine you’re the national sales manager for a laptop case manufacturer, and your workbook has tabular sales data broken down by month. You want more insight into how well premium cases sold last year.

1. Create Your New Measure

Click on an empty cell, navigate to โ€œmeasures,โ€ and select โ€œnew measure.โ€ Name the calculation you want to establish, which might be โ€œpremium case salesโ€ in this example. In the bottom portion of the dialogue box, type โ€œcalculateโ€ to begin building the DAX query.

2. Choose Your Expression

This value represents the component you want to adjust using the filters you select. In other words, what is the data you’ll filter for context? For this example, the expression is โ€œtotal salesโ€ โ€” the value you’ll filter to pull premium versus standard data in the next step. Add this expression after the opening bracket next to โ€œCALCULATEโ€ in the dialogue window. Typing the first few letters should automatically display a list of data tables to select.

3. Add Your Filter Context

Next, determine the filters based on the relationships between your tables. You can visualize these relationships in the โ€œPower Pivotโ€ option under โ€œData model,โ€ then โ€œmanage,โ€ and โ€œdiagram view.โ€ Add the filter โ€œcase typeโ€ by typing in the first few letters and choosing this data table.

Now, you enter the filter context โ€” the data you want to include in your query. There will be two options in this table โ€” premium and standard. To calculate sales for premium cases, add an equal sign after the table name and then โ€œpremiumโ€ in quotes. That indicates the program should pull only data where the โ€œcase typeโ€ field contains the value โ€œpremium.โ€

Once your filters are in place, end the expression with a closing bracket and click โ€œOK.โ€ Your workbook now displays a new column for “premium case sales” month by month.

You can customize your DAX queries with more filters or additional measures. For example, you could add a new measure for โ€œcase colorโ€ or โ€œcase sizeโ€ to further break down your premium case sales data.

Learn More About Managed IT Services from Agio

We’re on a mission to make technology safer and easier with comprehensive IT management solutions. Our team helps support industry compliance and keep IT spending in check.

Learn how we can help you by contacting an Agio specialist online.