Categories: Power BI
Tags:

We will learn practical usage of following operators in Power BI

Arithmetic operator
Comparison operators
Text concatenation operator
Logical operators

Here are DAX code examples to teach DAX Operators (Arithmetic, Comparison, Text Concatenation, Logical) using the Financial Sample Dataset in Power BI. The dataset typically includes columns like Sales, Profit, Country, Segment, Discount Band, etc.

Dataset: https://go.microsoft.com/fwlink/?LinkID=521962


🔢 1. Arithmetic Operators

Operators: +, -, *, /, ^

Total Revenue = SUM('Financials'[Sales]) + SUM('Financials'[Profit])
Profit Margin = DIVIDE(SUM('Financials'[Profit]), SUM('Financials'[Sales]))
Profit Increase = SUM('Financials'[Profit]) * 1.10
Sales Square = SUM('Financials'[Sales]) ^ 2

⚖️ 2. Comparison Operators

Operators: =, <>, <, <=, >, >=

High Sales = IF(SUM('Financials'[Sales]) > 50000, "High", "Low")
Profitable = IF('Financials'[Profit] >= 0, TRUE(), FALSE())
Loss Region = IF('Financials'[Profit] < 0, 'Financials'[Country], BLANK())

🔤 3. Text Concatenation Operator

Operator: &

Country Segment = 'Financials'[Country] & " - " & 'Financials'[Segment]

Custom Label = 
"Region: " & 'Financials'[Country] & 
", Segment: " & 'Financials'[Segment] & 
", Sales: $" & FORMAT('Financials'[Sales], "0.00")

🔁 4. Logical Operators

Operators: &&, ||, NOT

High Sales AND High Profit = 
IF('Financials'[Sales] > 40000 && 'Financials'[Profit] > 10000, "Top", "Average")

High Sales OR High Profit = 
IF('Financials'[Sales] > 40000 || 'Financials'[Profit] > 10000, "Potential", "Low")

Not Profitable = 
IF(NOT('Financials'[Profit] > 0), "Loss", "Profit")

Tip for Learning

Use cards, tables, or conditional formatting visuals to show the output clearly for each column.