Forum Discussion

JamesMurg's avatar
JamesMurg
Helper I
3 years ago
Solved

IF DAX code help

Morning all, HAPPY FRIDAY!!   Please could someone help with the below DAX code as it will not work for me 🙂   Column 2 = IF(AND( 'Report 1'[Destination ID]="IOMA",('Report 1'[Destination ID...
  • mlsx4's avatar
    3 years ago

    Hi JamesMurg 

     

    You haven't defined the correct structure for the formula. First of all, IF takes 3 parameters  (condition, what you will do if condition is met, otherwise).
    On the other hand, if you want to check if Destination ID is IOMA, IOMRT, UK653 or IOM you cannot use "AND", you should use "OR". Also, the formula cannot take more than two parameters, so you will need to use "||" operator.


    Therefore you should have something like:

     

     

    Column 2 =
    IF('Report 1'[Destination ID]="IOMA" ||'Report 1'[Destination ID]="IOMRT"|| 'Report 1'[Destination ID]="UK653"|| 'Report 1'[Destination ID]="IOM",
    "Isle of Man",
    <value in other case>)