Menu
CoddyTech

범위에 SWITCH(TRUE()) 사용하기

Coddy Power BI 여정의 CALCULATE를 활용한 DAX 섹션에 포함된 레슨. 24개 중 20번째.

SWITCH(TRUE(), test1, result1, test2, result2, else): 첫 번째 참인 테스트가 선택됩니다.

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

가장 범위가 좁은 테스트를 먼저 배치하세요. 그렇지 않으면 범위가 더 넓은 테스트가 해당 행을 잡아냅니다.

challenge icon

챌린지

쉬움

Price Band 열을 Products에 추가하세요. 단가가 10 이상이면 "Premium", 4 이상이면 "Standard", 그 외에는 "Budget"으로 설정하세요.

직접 해보기

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

CALCULATE를 활용한 DAX의 모든 레슨