Power BI: using variables (part 2)

Опубликовано: 05 Август 2026
на канале: Speak English Clearly
120
3

To use variables, follow the two steps:

1. Create a measure and add the variables, by writing VAR var_name = [Valid DAX formula]

2. Return the calculation for the set variable by writing RETURN [Another DAX formula with the variable used as part of the calculation.

Download sample file: https://bit.ly/31lsjQ8

The DAX formula used in the video example:

Profit in Russia =
VAR TotalSalesRussia = CALCULATE(
SUMX( Sales, Sales[UnitPrice] * Sales[SalesQuantity] ), Geography[RegionCountryName] = "Russia")

VAR TotalCostRussia = CALCULATE(
SUMX( sales, Sales[UnitCost] * Sales[SalesQuantity]), Geography[RegionCountryName] = "Russia")

RETURN
TotalSalesRussia - TotalCostRussia

To learn more about Power BI and DAX formulas, follow us on social media:   / centida  

#PowerBI #DAX #VAR