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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
yaya1974
Frequent Visitor

IF(And statements

Bucket = if(AND('Open Sales 55 7 15 3'[Over 15 Days]=true,"over 15",IF(and('Open Sales 55 7 15 3'[6 to 15 Days]=true,"6 to 15 days past due",IF(and('Open Sales 55 7 15 3'[0 to 5 Days]=true,"1 to 5 days past due",if(and('Open Sales 55 7 15 3'[Promise Month]='Open Sales 55 7 15 3'[Next Month],'Open Sales 55 7 15 3'[Promise Year]='Open Sales 55 7 15 3'[Year],"next month",if(and('Open Sales 55 7 15 3'[Promise Month]='Open Sales 55 7 15 3'[Next Month]-1,'Open Sales 55 7 15 3'[Promise Year]='Open Sales 55 7 15 3'[Year]),"this month","future")))))))))
 
my column is bucket and I am trying to get powerbi to bring me back texts if certain column is true, it works in excel but now powerbi.  can someone please help me?
 
telling me too many arguments were passed to the AND function.  the maximum argument count for the function is 2.
 
5 REPLIES 5
yaya1974
Frequent Visitor

my  columns that equal true/false are data type true/false and my number columns are data tpe text.

how do I check which is string and non-string?

Dangar332
Super User
Super User

hi, @yaya1974 

 

 

use switch() function instead of IF.


like 

bucket =
switch(true(),

'Open Sales 55 7 15 3'[Over 15 Days]=true,"over 15",
'Open Sales 55 7 15 3'[6 to 15 Days]=true,"6 to 15 days past due",
'Open Sales 55 7 15 3'[0 to 5 Days]=true,"1 to 5 days past due",
and continue ........)

 

Hi.  I actually was just trying that.  it seems to work, but got error now that states:

DAX comparison operations do not support comparing values of type True/False with value of type Text. Considering using VALUE or FORMAT function to convert one of the values.    

 

Have any suggestions?

Thanks so much!!

Hi, @yaya1974 

 

One of your column is type string and you compare it with non-string type column. So these problems occur so check it 

my  columns that equal true/false are data type true/false and my number columns are data tpe text.

how do I check which is string and non-string?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.