Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Custom Column with Ifs/And statement

Hi - I'm new to BI and trying to figure out the best way to create the below  custom column in an existing report.

 

Looking to return 'accept' in the new column if each Col A/B/C contain any of the values provided in Col1/2/3, respectively. All rows not meeting this criteria would simply return 'other' in the new column.

 

So for each row, If ColA contains one of the values provided in Col1, AND ColB contains one of the values provided in Col2, AND ColC contains one of the values provided in Col3, then Return 'accept' in the custom colum

 

thank you!

 

 Report 1    Report 2 
Col ACol BCol CCustom Col Col 1Col 2Col 3
5orangexPass 1applex
2appleyAccept 2bananay
19kiwizPass 3kiwiz
5bananayAccept 4  
4applezAccept 5  
1kiwioPass    
3grapepPass    
2grapeyAccept    
  • Hi,

     

    Please try this measure:

    Measure = IF(MAX(Report1[Col A]) in FILTERS(Report2[Col 1])&&MAX(Report1[Col B]) in FILTERS(Report2[Col 2])&&MAX(Report1[Col C]) in FILTERS(Report2[Col 3]),"Accept","Pass")

    And the result shows:

    Hope this helps.

     

    Best Regards,

    Giotto Zhi

1 Reply

  • v-gizhi-msft's avatar
    v-gizhi-msft
    Community Support

    Hi,

     

    Please try this measure:

    Measure = IF(MAX(Report1[Col A]) in FILTERS(Report2[Col 1])&&MAX(Report1[Col B]) in FILTERS(Report2[Col 2])&&MAX(Report1[Col C]) in FILTERS(Report2[Col 3]),"Accept","Pass")

    And the result shows:

    Hope this helps.

     

    Best Regards,

    Giotto Zhi