【发布时间】:2023-01-06 23:17:02
【问题描述】:
我想让一定比例的白人分开,而其余种族将是目前正在从事的项目中的有色人种。请帮助我如何使用 CASE 或 IF 语句编写 DAX。
我使用了 SWITCH,它给出了错误
Race_Ethnicity =
SWITCH(TRUE(),
'Contact'[race_and_ethnicity] = "White or European", "White or European",
'Contact'[race_and_ethnicity] = "Black or African", "Black or African",
'Contact'[race_and_ethnicity] = "Hispanic or Latinx", "Hispanic or Latinx",
'Contact'[race_and_ethnicity] = "Prefer not to answer", "Prefer not to answer",
'Contact'[race_and_ethnicity] = "South Asian", "South Asian",
'Contact'[race_and_ethnicity] = "East Asian", "East Asian",
'Contact'[race_and_ethnicity] = "Middle Eastern", "Middle Eastern",
'Contact'[race_and_ethnicity] = "Southeast Asian", "Southeast Asian",
'Contact'[race_and_ethnicity] = "Pacific Islander", "Pacific Islander",
'Contact'[race_and_ethnicity] = "Indigenous","Indigenous",
'Contact'[race_and_ethnicity] = "Other, please specify:", "Other, please specify:",
'Contact'[race_and_ethnicity] = ".*(;).*", "Mixed Race or Ethnicity",
)
我希望有白人或欧洲人的百分比以及有色人种的百分比
【问题讨论】:
标签: if-statement powerbi case dax