Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

case when or if with strings in Power Query

I am new to Power BI but have used SQL. Both M and DAX are making me feel stupid!! Thanks for letting me vent.   I have a column that groups students into 8 different types. I want to use an if sta...
  • wdx223_Daniel's avatar
    3 years ago

    if List.Contains({"TRAD","5YTRD","PTTRAD"},[College]) then "Traditional"

  • mussaenda's avatar
    3 years ago

    Hi Anonymous ,

     

    I understand that in SQL, you should be using ' '.

    But in Power Query, it should be " ".

     

     if

    [College] = "ADULT"

    then "Fleer"
    else

     

    if [College] = "GRAD"

    then "Graduate"
    else

     

    if

    Text.Start( [College], 1) = "V"

    then "Nondegree"
    else

     

    "Traditional"

     

     

    -----------

    if

    List.Contains( {"TRAD","5YTRD","PTTRAD"}, [College] )

    then "Traditional"

    else

     

    YourConditon

     

    Hope this helps