Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Tevon713
Helper IV
Helper IV

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")))))))

2 ACCEPTED SOLUTIONS
smpa01
Super User
Super User

@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"
)
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

KNP
Super User
Super 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"
)

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

View solution in original post

2 REPLIES 2
KNP
Super User
Super 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"
)

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x
smpa01
Super User
Super User

@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"
)
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.