Search code examples
if-statementconditional-statementspowerapps

Powerapps Multiple If Statements


I am trying to get multiple If statements working based on a sharepoint value i can get it working as one If statement but not as multiple see examples

Working

If(
IsBlank(LookUp(RP_Tasks_SPList,
        Task_Owner = Label3.Text && Task_Type_Short="FLT" && 
Text(DateValue(Date_of_Task_From), "yyyy-mm-dd") = Text(DateTimeValue(Button2_2.Text), "yyyy- 
mm-dd"))),Color.AliceBlue,Color.DarkRed) 

Example of what is'nt working

If(
IsBlank(LookUp(RP_Tasks_SPList,
        Task_Owner = Label3.Text && Task_Type_Short="FLT" && 
Text(DateValue(Date_of_Task_From), "yyyy-mm-dd") = Text(DateTimeValue(Button2_2.Text), "yyyy- 
mm-dd"))),Color.YellowGreen,


IsBlank(LookUp(RP_Tasks_SPList,
        Task_Owner = Label3.Text && Task_Type_Short="MCE" && 
Text(DateValue(Date_of_Task_From), "yyyy-mm-dd") = Text(DateTimeValue(Button2_2.Text), "yyyy- 
mm-dd"))),Color.DarkGreen,Color.DarkRed)

Any help would be appreciated

enter image description here

enter image description here


Solution

  • I have managed to get the result i required

        !IsBlank(
        LookUp(
            RP_Tasks_SPList, Task_Owner = Label3.Text && 
    Task_Type_Short="MCE" && Text(DateValue(Date_of_Task_From), "yyyy-mm- 
    dd") = Text(DateTimeValue(Button2_2.Text), "yyyy-mm-dd")
        )
    ),
    Color.DarkGreen,
    
    !IsBlank(
        LookUp(
            RP_Tasks_SPList, Task_Owner = Label3.Text && 
    Task_Type_Short="A/L" && Text(DateValue(Date_of_Task_From), "yyyy-mm- 
    dd") = Text(DateTimeValue(Button2_2.Text), "yyyy-mm-dd")
        )
    ),
    Color.MediumPurple,
    RGBA(241,244,249, 1)
    )