Menu
CoddyTech

Aralıklar için SWITCH(TRUE())

Coddy'nin Power BI Journey'sinin CALCULATE ile DAX bölümünün bir parçası. Ders 20 / 24.

SWITCH(TRUE(), test1, result1, test2, result2, else): ilk doğru test kazanır.

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

En dar testi önce koy; yoksa daha geniş bir test onun satırlarını yakalar.

challenge icon

Görev

Kolay

Price Band adlı bir sütunu Products tablosuna ekle: birim fiyatı 10 veya daha fazlaysa "Premium", 4 veya daha fazlaysa "Standard", diğer durumlarda "Budget".

Kendin dene

Price Band =
ProductCategoryPrice Band
EspressoCoffee
LatteCoffee
CappuccinoCoffee
Alanlar
  • Sales
  • Products
    • ProductID
    • Product
    • Category
    • UnitPrice
    • UnitCost
  • Stores
  • Customers
  • Dates
  • Targets

CALCULATE ile DAX bölümündeki tüm dersler