Three alternative DAX calculations

DAX stands for Data Analysis Expressions and is the language used by PowerBI to create calculations. The syntax is quite different to SQL and involves a lot of brackets and commas.

Below are three examples that show two different ways the same output can be achieved using DAX:

AND( ) vs &&

The below example will find the products that are items of clothing and are less than £30.

IF (AND (Table[Price]<30, Table[Category] = "Clothing"), "Sale Item", "Regular Item")
IF (Table[Price]<30 && Table[Category]="Clothing", "Sale Item", "Regular Item")

MONTH( ) vs .[MonthNo]

Both expressions below will return the month number of the date with .[MonthNo] removing the need for brackets entirely.

MONTH (Table[Date])
Table[Date].[MonthNo]

Nested IF functions vs SWITCH( )

The SWITCH function reduces the need for multiple IF functions where a missing bracket can easily break the function.

IF (Table[Price]<10, "Low", IF(Table[Price]<30, "Medium","High"))
SWITCH (TRUE( ), Table[Price]<10, "Low", Table[Price]<30, "Medium", "High")
Author:
Joseph Darton
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab