Forum Discussion
nniphadk
3 years agoFrequent Visitor
Column with multiple conditions
Good Morning π I am struggling with creating a column/conditional column Conditions: β BD: TR Type = CRD, TR Code = 123, BK Trx # = 41, TR Text Does Not Contain "DCD" β MD: TR Type = CRD, TR Co...
Greg_Deckler
3 years agoCommunity Champion
nniphadk That would be one long, nasty if statement in Power Query. DAX might be cleaner:
Column =
SWITCH(TRUE(),
[TR Type] = "CRD" && [TR Code] = 123 && [BK Trx #] = 41 && NOT(CONTAINSSTRING([TR Text], "DCD")), "BD",
[TR Type] = "CRD" && [TR Code] = 123 && [BK Trx #] = 41 && CONTAINSSTRING([TR Text], "DCD"), "MD",
[TR Type] = "CRD" && [TR Code] = 123 && [BK Trx #] = 54, "LD"
)
If you can provide sample data as text in a table, could be more complete with the solution. The last case is going to be similar although the leading zeros could be an issue. Are there a constant number of leading zeros or is it variable?