cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

IF /AND statements

Hello All, 

 

I want to add column for follwing formula. The status showed "Operator or expression "()" is not in this context 

 

New Column Overall rating 

 

IF(

ISBLANK([Column], BLANK(), 

IF(AND([Column1] = "1" && [Column2] = "1" && [Column3]= "1"), "1",

IF(AND([Column1] = "2" && [Column2] = "2" && [Column3] = "2"),"2", 

IF(AND([Column1] = "3" && [Column2] = "3" && [Column3] = "3"),"3","0"

)

)

)

 

Or should i use other filter ? 

 

 

Thanks in advance 

SWEZIN

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Hi @SWEZIN ,

 

 

Create a Calculated Column

 

Calculated Column =
SWITCH (
    TRUE (),
    'Table'[Column1] = "1"
        && 'Table'[Column2] = "1"
        && 'Table'[Column3] = "1", "1",
    'Table'[Column1] = "2"
        && 'Table'[Column2] = "2"
        && 'Table'[Column3] = "2", "2",
    'Table'[Column1] = "3"
        && 'Table'[Column2] = "3"
        && 'Table'[Column3] = "3", "3",
    'Table'[Column1]
        = BLANK ()
        || 'Table'[Column2]
            = BLANK ()
        || 'Table'[Column3]
            = BLANK (), BLANK (),
    "0"
)

 

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

View solution in original post

5 REPLIES 5
Highlighted
Super User III
Super User III

@SWEZIN ,

 

The and function gets 2 parameters. Use nested and's or &&, not both together.

 

https://docs.microsoft.com/pt-br/dax/and-function-dax



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Highlighted
Super User II
Super User II

Hi @SWEZIN ,

 

Your DAX expression doesn't seem to be correct. Based on the limited information, try modifying it as follows:

 

IF(

    ISBLANK([Column]), BLANK(), 

    IF([Column1] = "1" && [Column2] = "1" && [Column3]= "1", "1",

        IF([Column1] = "2" && [Column2] = "2" && [Column3] = "2","2", 

            IF([Column1] = "3" && [Column2] = "3" && [Column3] = "3","3","0"

               )

           )

        )

   )

 

I am not sure why you were using AND operator with && operator. Also, your ISBLANK() brackets were not closed correctly.

If the above DAX doesn't work, then detail your requirement.

 

Thanks,

Pragati





If this helps, Appreciate a KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




Highlighted
Super User IV
Super User IV

@SWEZIN , isblank not closed properly, but try switch

 switch( true(),
ISBLANK([Column]), BLANK(), 
AND([Column1] = "1" && [Column2] = "1" && [Column3]= "1"), "1",
AND([Column1] = "2" && [Column2] = "2" && [Column3] = "2"),"2", 
AND([Column1] = "3" && [Column2] = "3" && [Column3] = "3"),"3"
,"0"

)

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Super User III
Super User III

Hi @SWEZIN ,

 

 

Create a Calculated Column

 

Calculated Column =
SWITCH (
    TRUE (),
    'Table'[Column1] = "1"
        && 'Table'[Column2] = "1"
        && 'Table'[Column3] = "1", "1",
    'Table'[Column1] = "2"
        && 'Table'[Column2] = "2"
        && 'Table'[Column3] = "2", "2",
    'Table'[Column1] = "3"
        && 'Table'[Column2] = "3"
        && 'Table'[Column3] = "3", "3",
    'Table'[Column1]
        = BLANK ()
        || 'Table'[Column2]
            = BLANK ()
        || 'Table'[Column3]
            = BLANK (), BLANK (),
    "0"
)

 

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

View solution in original post

Highlighted

@amitchandak 

The formula still have error with following message. 

SWEZIN_0-1594134550076.png

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors