else
2 TopicsIf, Or, Else not working
I am working with customer data and I am trying to segment them based on various demographic and lifestage information e.g. if someone is 18-21 years old or 35-39 years old and working full time or partime and not married and does not have kids then they belong to 'segment A' else (a different permutation of the variables above and they fall into 'segment b')etc. I have used If, or, and, then and else but it not producting the right results. I tried using SWITCH but it gave me the " the name 'SWITCH' wasn't recoganised. Make sure it's spelled correctly" error, which I belive has something to do with adding table Vs column. My DAX code looks like below; =if [Q1_Age] = "Under 18" or [Q1_Age] = "18-21" or [Q1_Age] = "22-29" or [Q1_Age] = "30-34" or [Q1_Age] ="35-39" and [#"Q6_Employment_Working full time (30 hours or more work per week)"]=1 or [#"Q6_Employment_Working part time (under 30 hours work per week)"]=1 and [Q2_Parent_None of these apply]=1 and [Q3_Marital_Status] = "Single/Never married" or [Q3_Marital_Status] = "De facto/Living with partner but not married" then "SEGMENT A" else if [Q1_Age] = "Under 18" or [Q1_Age] = "18-21" or [Q1_Age] = "22-29" or [Q1_Age] = "30-34" or [Q1_Age] ="35-39" and [Q3_Marital_Status] = "De facto/Living with partner but not married" or [Q3_Marital_Status] ="Seperated" or [Q3_Marital_Status] ="Divorced" or [Q3_Marital_Status] ="Engaged/Planning to marry" or [Q3_Marital_Status] ="Single/Never married" or [Q3_Marital_Status] ="Married" and [#"Q2_Parent_I have a child/children under 18 living with me"]=1 or [#"Q2_Parent_I have a child/children over 18 living with me"] =1 or [#"Q2_Parent_I have a child/children who have moved out of home"] =1 then "SEGMENT B" else... Can someone guide me on how to identify (or fix) the reason why this is not working, please! Thanks!Solved2.6KViews0likes12CommentsNew column based on values/string of two other columns
Im new to PBI and trying to recreate an expression from another package and having some issues due to inexperience with PBI. Im trying to create a new column with string "pass" or "fail".Below is generaly what im trying to do new = if( [col01] = ''abc'' && [col02] > 20, ''fail'', elseif [col01] = ''def'' && [col02] > 50, ''fail'', elseif [col01] = ''ghi'' && [col02] > 100, ''fail'', pass ) Questions: 1. Is there an elseif type function in PBI? 2. Without trying to nest and using the follwing expression i get the following warning. new = IF( [col01] = ''abc'' && [col02] > 20, ''fail'', "pass") DAX comparison operations do not support comparing values of type Text with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values. is there a solution to this? Advice, links to pages that may help greatly appreciated. rstySolved2.6KViews0likes3Comments