如何在TSQL中执行以下DAX表达式?
Channel Mapping: =
SWITCH(
TRUE (),
NOT ( ISERROR ( SEARCH ( "ChannelOne", ChannelFact[ChannelName] ) ) ), "C1",
NOT ( ISERROR ( SEARCH ( "ChannelTwo", ChannelFact[ChannelName] ) ) ), "C2",
NOT ( ISERROR ( SEARCH ( "Channel2", ChannelFact[ChannelName] ) ) ), "C2",
"Not Mapped"
)
我认为它需要CASE逻辑,但不确定如何组合。
答案 0 :(得分:1)
SELECT CASE ChannelName WHEN "ChannelOne" THEN "C1"
WHEN "ChannelTwo" THEN "C2"
WHEN "Channel2" THEN "C2"
ELSE "Not Mapped" END AS "Channel Mapping"
FROM
ChannelFact
感谢。