Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

if statement with AND construction

hi

 

want to use a simple statement but in the advanced editor of query editor i seems to be missing something....

this is what i have:

Account groups= 999999, 90000 and 87000 plus we have an costcenter in range 240, 200, 250, 300, 270, 777

so if the Account group is 999999 AND the costcenter is in range of 200, 240, 270 then B1. Automatic else NULL

Tried this so far, unfortunately without succes...

if [Account Group] = "999999" and [Costcenter] in ('200', '240', '270') then B1. = failed

if [Account Group] = "999999" &&  [Costcenter] in ('200', '240', '270') then B1. = failed

any ideas?

thanks!

M

  • HI Anonymous

     

    Try this

     

    if [Account Group] = 999999 and List.Contains({200, 240, 270},[Costcenter] ) then [B1] else null

     

    If the Columns Account Group and Costcenter are of Text Type then use ""

     

    if [Account Group] = "999999" and List.Contains({"200","240", "270"},[Costcenter] ) then [B1] else null

1 Reply

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Community Champion

    HI Anonymous

     

    Try this

     

    if [Account Group] = 999999 and List.Contains({200, 240, 270},[Costcenter] ) then [B1] else null

     

    If the Columns Account Group and Costcenter are of Text Type then use ""

     

    if [Account Group] = "999999" and List.Contains({"200","240", "270"},[Costcenter] ) then [B1] else null