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
EasyThe 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 =| Store | City | Language |
|---|---|---|
| Lisbon Riverside | Lisbon | |
| Porto Ribeira | Porto | |
| Madrid Centro | Madrid |
- Sales
- Products
- Stores
- StoreID
- Store
- City
- Country
- OpenDate
- Customers
- Dates
- Targets
All lessons in DAX with CALCULATE
1Changing the Filters
Meet CALCULATEA Filter Replaces a FilterSeveral Filters at OnceKeeping FiltersRecap - Member Drink Sales4DAX You Can Read
Variables with VARChoosing with SWITCHSWITCH(TRUE()) for RangesOne Value or ManyRows or the TotalChecking Copilot's DAXRecap - Sales by Price Band