How to create your first DAX measure in Power BI
Measures are the heart of any report in Power BI: they are what transform data columns into numbers that answer business questions like "how much did we sell this month?". You will create your first DAX measure, end to end, even if you have never written a formula.
Prerequisites
- Power BI Desktop installed (the free version is enough).
- A model with at least one sales table — with a value column, for example
Valor. - A willingness to experiment: no programming knowledge required.
Step 1: Open the data view and choose the table
In Power BI Desktop, click the Table icon (data view) on the left and select the table where you want the measure — for example, Vendas. Measures are associated with a table, but can use data from the entire model.
Step 2: Create a new measure
On the Modeling tab, click New measure. The formula bar opens, where you will write your DAX expression.
Step 3: Write the formula
Let's start with the most common measure of all: total sales. Type:
Total de Vendas = SUM('Vendas'[Valor])
Note two things: to the left of the = is the name of the measure; to the right, the expression. The SUM function adds all the values of the Valor column, but the result automatically adjusts to the report context (by month, by product, etc.).
Step 4: Use the measure in a visualization
Return to the Report view, insert a Card visual and drag your measure Total de Vendas there. The card shows the total. Now insert a bar chart, put the measure in values and a dimension (like Mês) on the axis, and you will see the total "break down" by month, without writing anything else.
Verify the result
To confirm it is correct, compare the card value with a manual sum of a small sample, or with a total you already know (for example, from an older report). If the numbers match, the measure is well built.
Conclusion
You created your first DAX measure, and the pattern you learned (Name = FUNCTION(column)) is the basis for practically everything else. From here, functions like CALCULATE, AVERAGE or time intelligence open up a world of analysis. What will be the next question you want to answer with a measure?