Menu
CoddyTech

Choosing with SWITCH

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

SWITCH(value, match1, result1, match2, result2, else)

Language = SWITCH(Stores[Country], "Portugal", "Portuguese", "Spain", "Spanish", "German")

No match gives the last argument. It replaces an IF inside an IF.

challenge icon

Challenge

Easy

The menus are printed per language. Add a column Language to Stores: "Portuguese" for Portugal, "Spanish" for Spain, and "German" for the rest.

Try it yourself

Language =
StoreCityLanguage
Lisbon RiversideLisbon
Porto RibeiraPorto
Madrid CentroMadrid
Fields
  • Sales
  • Products
  • Stores
    • StoreID
    • Store
    • City
    • Country
    • OpenDate
  • Customers
  • Dates
  • Targets

All lessons in DAX with CALCULATE