Forum Discussion

Jay2022's avatar
Jay2022
Icon for Helper IV rankHelper IV
2 years ago
Solved

MUltiple IF and statements

Hi I keep getting Syntax errors when I try the following formula. Where am I going wrong 

 

New_Column = IF('Table'[Store]= "A", "A",

IF('Table'[Store]= "B", "B",

IF('Table'[Store]= "C", && (‘Table’[Sales Date]<=TODAY(), “B”

IF('Table'[Store]= "D", && (‘Table’[Sales Date]<=TODAY(), “B”

IF('Table'[Store]= "C", && (‘Table’[Sales Date]>TODAY(), “C”

IF('Table'[Store]= "D", && (‘Table’[Sales Date]>TODAY(), “D”,” ”))

  • Hi, Jay2022 

     

    If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.

3 Replies

  • Dangar332's avatar
    Dangar332
    Icon for Resident Rockstar rankResident Rockstar

    Hi, Jay2022 
    Jay2022 


    try below code remove (" , ")

     

     

     

     

    New_Column = IF('Table'[Store]= "A", "A",
    
    IF(
    'Table'[Store]= "B", "B",
    
    IF('Table'[Store]= "C" && ‘Table’[Sales Date]<=TODAY(), “B”,
    
    IF('Table'[Store]= "D" && ‘Table’[Sales Date]<=TODAY(), “B”,
    
    IF('Table'[Store]= "C" && ‘Table’[Sales Date]>TODAY(), “C”,
    
    IF('Table'[Store]= "D" && ‘Table’[Sales Date]>TODAY(), “D”,” ”)
    )))))

     

     

     

    or use switch() function

     

     

    New_Column = 
    switch(true(),
    'Table'[Store]= "A", "A",
    'Table'[Store]= "B", "B",
    'Table'[Store]= "C" && ‘Table’[Sales Date]<=TODAY(), “B”,
    'Table'[Store]= "D" && ‘Table’[Sales Date]<=TODAY(), “B”,
    'Table'[Store]= "C" && ‘Table’[Sales Date]>TODAY(), “C”,
    'Table'[Store]= "D" && ‘Table’[Sales Date]>TODAY(), “D”,” ”
    )

     

     

     

    • Dangar332's avatar
      Dangar332
      Icon for Resident Rockstar rankResident Rockstar

      Hi, Jay2022 

       

      If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.