How to Access DAX in Power BI

Cody Schneider

Trying to figure out where you actually write DAX formulas in Power BI can feel like searching for a hidden button. You know that you need DAX to create the powerful, custom calculations that make your reports truly insightful, but the interface isn't always obvious about where to start. This tutorial will show you exactly where to access and write DAX in Power BI, focusing on the three main places you'll spend your time: calculated columns, measures, and calculated tables.

First, a Quick Refresher: What is DAX?

DAX stands for Data Analysis Expressions. It's not a full-blown programming language like Python, but a formula language that works with relational data, just like the data you have in Power BI. Think of it as Excel formulas on steroids.

While Excel formulas operate on individual cells (like =A2+B2), DAX operates on entire columns and tables (like SUM(Sales[Revenue])). This allows you to create much more powerful and flexible calculations that respond dynamically to your report's filters and slicers.

Learning DAX is what transforms a Power BI user from someone who can create basic charts to someone who can build sophisticated analytical models to answer complex business questions. It's the engine that powers the "intelligence" in business intelligence.

Where to Write DAX Formulas in Power BI

DAX isn't written in a single dedicated "DAX window." Instead, you create DAX expressions inside your data model in three primary areas. Understanding when to use each is an important first step.

1. Calculated Columns

A calculated column adds a new column to one of your existing tables, just as if it were a column pulled from your original data source. The key thing to remember is that the formula for a calculated column is evaluated for each row in your table during the data refresh process. Its value is then stored in your data model.

When to use a calculated column:

  • When you need a calculation that evaluates on a row-by-row basis. For example, calculating profit for each sales transaction ([SalesPrice] - [UnitCost]).

  • When you want to use the result in a slicer, a filter, or as an axis in a visual. Measures can't be used in these places.

  • When you need to define categories or segments based on data in a row (e.g., using an IF statement to categorize sales as "Large," "Medium," or "Small").

How to Create a Calculated Column:

You can create a calculated column from either the Report View or the Data View, but it's often easiest to do in the Data View where you can immediately see the new column you're adding to your table grid.

Here’s how to do it step-by-step:

  1. Navigate to the Data View by clicking the grid icon on the left-hand pane.

  2. Select the table you want to add the column to from the Fields pane on the right.

  3. Once your table is visible in the main window, the Table tools ribbon will appear at the top. Click on New column.

  4. The DAX formula bar will appear below the ribbon. This is where you write your formula.

  5. Write your DAX formula. For example, to create a Profit column, you might write:

    Profit = Sales[Unit Price] - Sales[Unit Cost]

  6. Press Enter. Power BI will perform the calculation for every row, and your new Profit column will appear in the table grid.

2. Measures

Measures are arguably the most common and powerful way to use DAX in Power BI. Unlike a calculated column, a measure doesn't calculate and store a value for every row in a table. Instead, a measure is a formula for an aggregation that is calculated on-the-fly based on the context of your report — that is, whatever filters are currently applied by your visuals, slicers, or other user interactions.

Because they are dynamic, measures are perfect for calculations you want to see in the "Values" section of visuals, like total sales, average order value, or year-over-year growth.

When to use a measure:

  • When you need to calculate an aggregated value like a sum, average, count, minimum, or maximum.

  • When you want the result to dynamically change based on slicers and filters in the report.

  • For common business metrics like Total Sales, Profit Margin, or YoY Growth %. This is because you always want to view these figures in aggregate, not on a row-by-row level.

How to Create a Measure:

  1. In either the Report View or Data View, locate the table where you'd like your new measure to live in the Fields pane on the right. (Often, people create a dedicated, empty "Measures Table" to keep their calculations organized, but putting them in a relevant table like 'Sales' is fine too.)

  2. Right-click on the table and select New measure.

  3. The DAX formula bar will appear, just as it did for the calculated column.

  4. Write your formula for the aggregation. For instance, to calculate total revenue, you would use the SUM function:

    Total Revenue = SUM(Sales[Revenue])

  5. Press Enter. You won’t see anything change in your table grid, because a measure has no "result" until you use it. However, you will see your new measure appear in the Fields list, denoted by a small calculator icon.

3. Calculated Tables

The third place you'll find yourself entering DAX is to create an entirely new table in your model from scratch. This is a very powerful feature for shaping your data model for better analysis.

When to use a calculated table:

  • To create a dynamic Date Table. This is one of the most common and important uses. A dedicated date table with a continuous list of dates allows you to perform time intelligence calculations (Month-over-Month, YTD, etc.).

  • To create a summary table that aggregates data from another table.

  • To union or combine different tables together in ways that aren't possible with transformations in Power Query.

How to Create a Calculated Table:

  1. Navigate to the Data View.

  2. From the Home tab on the ribbon, click the New table option.

  3. The formula editor will open, ready for your DAX expression that defines the table.

  4. A very common formula for a Dates table is using the CALENDARAUTO function, which automatically scans your entire data model for the earliest and latest dates and creates a continuous date range between them.

    Dates = CALENDARAUTO()

    It only takes one line to generate a robust date table you can connect to your data.

  5. Press Enter. Power BI will create and display the new table in your model.

Tips for Using the DAX Formula Bar

Now that you know where to write DAX, it's helpful to get familiar with the formula bar itself. It has several features to make your life easier.

  • Auto-complete (IntelliSense): As you start typing, Power BI provides suggestions for functions, tables, and columns that match your input. Use the arrow keys and Tab to accept suggestions. This helps minimize typos and helps you find the function you need.

  • Syntax Highlighting: The formula bar color-codes your text to improve readability. Functions are typically green, table names are dark blue, and column names are light blue within brackets. Invalid syntax or errors will turn red and be underlined with a squiggle.

  • Make it Readable: Long, complex DAX formulas can become a nightmare to read on a single line. Use Shift + Enter to create a new line and use the Tab key to indent sections of your formula. This makes nested functions much easier to debug and understand. For example, instead of this:

    Profit YoY % = DIVIDE([Total Profit] - CALCULATE([Total Profit], SAMEPERIODLASTYEAR('Dates'[Date])), CALCULATE([Total Profit], SAMEPERIODLASTYEAR('Dates'[Date])))

    You can format it like this, which is much clearer:

    Profit YoY % = DIVIDE( [Total Profit] - CALCULATE( [Total Profit], SAMEPERIODLASTYEAR( 'Dates'[Date] ) ), CALCULATE( [Total Profit], SAMEPERIODLASTYEAR( 'Dates'[Date] ) ) )

  • Add Comments: Just like with any code, it can be helpful to leave comments for yourself or your team explaining what a complex formula is doing.

    • Use two forward slashes // for a single-line comment.

    • Use /* to start and */ to end a multi-line comment.

A Quick Workflow to Get Started

If you're still feeling unsure, follow this simple workflow every time you need to create a new calculation:

  1. Start with a Business Question: What answer are you trying to find? ("What was our total revenue for last quarter?")

  2. Row vs. Aggregate: Is this question answered on a row-by-row basis or as an aggregation? Most business questions (revenue, costs, counts) involve aggregation. This points you toward a measure. If you need to categorize each row, you probably need a calculated column.

  3. Create the Calculation: Go to the correct place in Power BI (e.g., right-click the table > New measure).

  4. Build the Formula Incrementally: Start simple. Begin with a function like SUM(). Use the auto-complete to find your column (e.g., SUM(Sales[Revenue])). Use functions like CALCULATE() to apply filters to that core aggregation.

  5. Test, Test, Test: Once you've written your measure, drag it into a Card visual on your report canvas. This simple visualization shows you the final result of your DAX and confirms if it’s working correctly before you put it into a more complex chart.

Final Thoughts

While DAX can seem intimidating at first, finding where to write it is the easy part. You can create sophisticated calculations by defining measures, creating new calculated columns to add context to your rows, or generating entire calculated tables to help shape your data model. Getting started is simply a matter of knowing which of those three features to choose based on your goal.

Of course, becoming truly proficient with DAX takes some time and effort. Instead of forcing your marketing or sales teams to spend hours learning formula languages or fighting with complex report builders, we created Graphed to simplify the entire process. You can connect all your sales and marketing data sources in seconds, then simply ask questions in plain English like, "Show me my campaign ROI by platform for last month," and Graphed instantly builds the dashboard for you - no DAX required.