Menu
CoddyTech

SWITCH(TRUE()) for Ranges

Part of the DAX with CALCULATE section of Coddy's Power BI journey. Lesson 20 of 24.

SWITCH(TRUE(), test1, result1, test2, result2, else): the first true test wins.

Price Band = SWITCH(TRUE(), Products[UnitPrice] >= 10, "Premium", Products[UnitPrice] >= 4, "Standard", "Budget")

Put the narrowest test first, or a wider test catches its rows.

challenge icon

Challenge

Add a column Price Band to Products: "Premium" for a unit price of 10 or more, "Standard" for 4 or more, and "Budget" for the rest.

bugsy Main icon

Start this challenge with Coddy's AI tutor

What is Bugsy?

All lessons in DAX with CALCULATE