Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Better way to structure multiple IF statements?

Hello - I have the following requirements to group items into a single "Comments" column:

a) Status Column: Under Review
Testing Status: all items in this column
Status Column: Open
Testing Status: In First Review, In Second Review

 

The goal is to group these into the "Comments" column.
I created the if statements below, but it only returns 3 items. There are a total of 11 items returned when I apply these filters in the excel table. 

Is there a better way to structure this? or what am i doing wrong where I only get 3 items? Any help is greatly appreciated!

 

 

 

if [Status]=  "Under Review" and [Testing Status] = "In Progress"

then "Comments"

else if [Status]=  "Under Review" and [Testing Status] = "In Review"

then "Comments"

else if [Status]=  "Under Review" and [Testing Status] = "In Review #2"

then "Comments"

else if [Status]=  "Under Review" and [Testing Status] = "Not Started"

then "Comments"

else if [Status]=  "Under Review" and [Testing Status] = "Not Yet Tested"

then "Comments"

else if [Status]=  "Under Review" and [Testing Status] = "Not Yet Tested 2"

then "Comments"

else if [Status]=  "Under Review" and [Testing Status] = "Pending Evidence"

then "Comments"

else if [Status]=  "Under Review" and [Testing Status] = "Tested by Team"

then "Comments"

else if [Status]=  "Under Review" and [Testing Status] = ""

then "Comments"

else if [Status]=  "Open" and [Testing Status] = "In First Review"

then "Comments"

else if [Status]=  "Open" and [Testing Status] = "In Second Review"

then "Comments"

  • Hi Anonymous ,

     

    You may change the power query codes like below in Query Editor.

     

    =if [Status]=  "Under Review" and
    
    ([Testing Status] = "In Progress"      
    
    or [Testing Status] = "In Review"
    
    or [Testing Status] = "In Review #2"
    
    or [Testing Status] = "Not Started"
    
    or [Testing Status] = "Not Yet Tested"
    
    or [Testing Status] = "Not Yet Tested 2"
    
    or [Testing Status] = "Pending Evidence"
    
    or [Testing Status] = "Tested by Team"
    
    or [Testing Status] = "" )
    
    then "Comments"
    
    else
    
      if [Status]=  "Open" and ([Testing Status] = "In First Review" or [Testing Status] = "In Second Review" )
    
      then "Comments"

     

    Best Regards,

    Amy 

     

    Community Support Team _ Amy

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

     

    Measure =
    SWITCH (
    TRUE (),
    [Status] = "Under Review"
    && ( [Testing Status] = "In Progress"
    || [Testing Status] = "In Review"
    || [Testing Status] = "In Review #2"
    || [Testing Status] = "Not Started"
    || [Testing Status] = "Not Yet Tested"
    || [Testing Status] = "Not Yet Tested 2"
    || [Testing Status] = "Pending Evidence"
    || [Testing Status] = "Tested by Team"
    || [Testing Status] = "" ), "Comments",
    [Status] = "Open"
    && ( [Testing Status] = "In First Review"
    || [Testing Status] = "In Second Review" ), "Comments"
    )

     

    Regards,

    Harsh Nathani

    Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

  • v-xicai's avatar
    v-xicai
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    You may change the power query codes like below in Query Editor.

     

    =if [Status]=  "Under Review" and
    
    ([Testing Status] = "In Progress"      
    
    or [Testing Status] = "In Review"
    
    or [Testing Status] = "In Review #2"
    
    or [Testing Status] = "Not Started"
    
    or [Testing Status] = "Not Yet Tested"
    
    or [Testing Status] = "Not Yet Tested 2"
    
    or [Testing Status] = "Pending Evidence"
    
    or [Testing Status] = "Tested by Team"
    
    or [Testing Status] = "" )
    
    then "Comments"
    
    else
    
      if [Status]=  "Open" and ([Testing Status] = "In First Review" or [Testing Status] = "In Second Review" )
    
      then "Comments"

     

    Best Regards,

    Amy 

     

    Community Support Team _ Amy

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.