Reputation: 39
I am very new to Power BI and I need help please in trying to identify certain customers based on set logic, I just don't know how best to do this. Below is a case statement from SQL to try and hopefully explain what I am trying to achieve, but I haven't ever written DAX or no enough about Power BI should there be a better way to identify these group?
when left(bt_type,3) in ('RRR','TTT') and bt_type in ('RT12') then 'Test_Group_One'
when bt_typein ('RT12') and left(bt_type,3) not in ('RRR','TTT') then 'Test_Group_Two'
else 'Exclude'
end as 'Test_Type'
Any help is greatly appreciated.
Upvotes: 0
Views: 25
Reputation: 16908
Try this below Measure Code-
Test_Type =
IF(
(left(bt_type,3) = "RRR" || left(bt_type,3) = "TTT") && bt_type = "RT12",
"Test_Group_One",
IF(
bt_type = "RT12" && (left(bt_type,3) <> "RRR" && left(bt_type,3) <> "TTT"),
"Test_Group_Two",
"Exclude"
)
)
Upvotes: 1