Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Calculated Column with multiple AND & OR

Hi, 

I need to create a calculated column with the following rules: 

Write 1 IF:
Project is within G0 to G5 and status is 1 and description field is blank 
OR (Project is within G0 to G5 and status is 2 and description field is blank)
OR (Project is within G0 to G5 and status is 0)
ELSE 0

I have tried the following statement but so far I haven't found a solution that works
Hope someone can help.

 

Overall Status =
    IF(
        AND(
                    OR(
                    Initiatives[Stage] = "Demand Qualification"  ||
                    Initiatives[Stage] = "G0 Approval" ||
                    Initiatives[Stage] = "G1 Approval" ||
                    Initiatives[Stage] = "G2 Approval" ||
                    Initiatives[Stage] = "G3 Approval" ||
                    Initiatives[Stage] = "G4 Approval" ||
                    Initiatives[Stage] = "G5 Approval",
                    AND(Initiatives[Status] = 1, Initiatives[Description] = BLANK())),
                   
                    AND(
                    Initiatives[Stage] = "Demand Qualification"  ||
                    Initiatives[Stage] = "G0 Approval" ||
                    Initiatives[Stage] = "G1 Approval" ||
                    Initiatives[Stage] = "G2 Approval" ||
                    Initiatives[Stage] = "G3 Approval" ||
                    Initiatives[Stage] = "G4 Approval" ||
                    Initiatives[Stage] = "G5 Approval",
                    AND(Initiatives[Status] = 2, Initiatives[Description] = BLANK()))),
                   
                    AND(
                    Initiatives[Stage] = "Demand Qualification"  ||
                    Initiatives[Stage] = "G0 Approval" ||
                    Initiatives[Stage] = "G1 Approval" ||
                    Initiatives[Stage] = "G2 Approval" ||
                    Initiatives[Stage] = "G3 Approval" ||
                    Initiatives[Stage] = "G4 Approval" ||
                    Initiatives[Stage] = "G5 Approval",
                    Initiatives[Status] = 0)),1,0)



  • Anonymous try this:

     

     

     

    Overall Status =
    IF(
    	Initiatives[Stage] 
    		IN {
    			"Demand Qualification", 
    			"G0 Approval", 
    			"G1 Approval", 
    			"G2 Approval",
    			"G3 Approval",
    			"G4 Approval",
    			"G5 Approval"
    		},
    		IF(
    			Initiatives[Status] = "0", 
    			1,
    			IF(
    				Initiatives[Status] IN {"1","2"}
    					&& Initiatives[Description] = BLANK().
    				1,
    				0
    			)
    		)
    )	
    				

     

     

     



    Showcase Report – Contoso By SpartaBI



          

6 Replies

  • SpartaBI's avatar
    SpartaBI
    Community Champion

    Anonymous try this:

     

     

     

    Overall Status =
    IF(
    	Initiatives[Stage] 
    		IN {
    			"Demand Qualification", 
    			"G0 Approval", 
    			"G1 Approval", 
    			"G2 Approval",
    			"G3 Approval",
    			"G4 Approval",
    			"G5 Approval"
    		},
    		IF(
    			Initiatives[Status] = "0", 
    			1,
    			IF(
    				Initiatives[Status] IN {"1","2"}
    					&& Initiatives[Description] = BLANK().
    				1,
    				0
    			)
    		)
    )	
    				

     

     

     



    Showcase Report – Contoso By SpartaBI



          

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Sparta, 

      Thanks for you reply. 
      When I try the provided solution I get the following error message:
      Function 'CONTAINSROW' does not support comparing values of type Integer with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.


      Any idea of how to get around that ?

      • SpartaBI's avatar
        SpartaBI
        Community Champion

        I think because your status column is a text, I'm adding "" around the relevant places in the original messages, you will see this in a minute