Forum Discussion

Tevon713's avatar
Tevon713
Icon for Helper V rankHelper V
4 years ago
Solved

Too few arguments were passed to the AND function.

Please advis, with the below error...  "Too few arguments were passed to the AND function. The minimum argument count for the function is 2." Not sure what's wrong, this work in excel formula.

 

FINAL Column=

IF(AND('Column1'[Value]<> "Other"), 'Column2'[Value],

(IF(AND('Column1'[Value]="Other", 'Column2'[Value]<>"Other"),'Column2'[Value],

(IF(AND('Column1'[Value]="Other", 'Column2'[Value]="Other",'Column3'[Value]<>"Other"),'Column3'[Value],

(IF(AND('Column1'[Value]="Other", 'Column2'[Value]="Other",''Column3'[Value]="Other",'Column4'[Value]<>"Other"), 'Column4'[Value],"Other")))))))

  • Tevon713  can you try this

    FINAL Column =
    SWITCH (
        TRUE (),
        'Column1'[Value] <> "Other", 'Column2'[Value],
        'Column1'[Value] = "Other" && 'Column2'[Value] <> "Other", 'Column2'[Value],
        'Column1'[Value] = "Other" && 'Column2'[Value] = "Other" && 'Column3'[Value] <> "Other", 'Column2'[Value],
        'Column1'[Value] = "Other" && 'Column2'[Value] = "Other" && 'Column3'[Value] = "Other" && 'Column4'[Value] <> "Other", 'Column4'[Value],
        "Other"
    )
  • Apart from the IF and AND being messy and hard to read, I think you have a problem with your referencing of columns.

    It is Table[Column] not Column[Value].

     

    Try this...

    (Change 'T' to whatever your table is called)

    FINAL Column =
    SWITCH (
        TRUE (),
        T[Column1] <> "Other", T[Column2],
        T[Column1] = "Other"
            && T[Column2] = "Other"
            && T[Column3] = "Other"
            && T[Column4] <> "Other", T[Column4],
        T[Column1] = "Other"
            && T[Column2] <> "Other", T[Column2],
        T[Column1] = "Other"
            && T[Column2] = "Other"
            && T[Column3] <> "Other", T[Column3],
        "Other"
    )
    

     

2 Replies

  • smpa01's avatar
    smpa01
    Icon for Community Champion rankCommunity Champion

    Tevon713  can you try this

    FINAL Column =
    SWITCH (
        TRUE (),
        'Column1'[Value] <> "Other", 'Column2'[Value],
        'Column1'[Value] = "Other" && 'Column2'[Value] <> "Other", 'Column2'[Value],
        'Column1'[Value] = "Other" && 'Column2'[Value] = "Other" && 'Column3'[Value] <> "Other", 'Column2'[Value],
        'Column1'[Value] = "Other" && 'Column2'[Value] = "Other" && 'Column3'[Value] = "Other" && 'Column4'[Value] <> "Other", 'Column4'[Value],
        "Other"
    )
  • KNP's avatar
    KNP
    Icon for Super User rankSuper User

    Apart from the IF and AND being messy and hard to read, I think you have a problem with your referencing of columns.

    It is Table[Column] not Column[Value].

     

    Try this...

    (Change 'T' to whatever your table is called)

    FINAL Column =
    SWITCH (
        TRUE (),
        T[Column1] <> "Other", T[Column2],
        T[Column1] = "Other"
            && T[Column2] = "Other"
            && T[Column3] = "Other"
            && T[Column4] <> "Other", T[Column4],
        T[Column1] = "Other"
            && T[Column2] <> "Other", T[Column2],
        T[Column1] = "Other"
            && T[Column2] = "Other"
            && T[Column3] <> "Other", T[Column3],
        "Other"
    )