Forum Discussion

tina_belcher123's avatar
tina_belcher123
Frequent Visitor
1 year ago
Solved

Measure to check if multiple values exist in another table

Hey Everyone! I've been stuck on this one for longer than i'd like to admit. I have 2 data sets that I would like to compare multiple values against. Basically, I want Power BI to check if each email...
  • TheoC's avatar
    1 year ago

    Hi tina_belcher123 

     

    Hopefully this meets your needs:

     

    BarColour = 
    
    VAR _3 = 
        CALCULATE ( 
            FIRSTNONBLANK ( 'Control Table'[Business Email] , 1 ) , 
            FILTER ( ALL ( 'Control Table' ) , 'Control Table'[Business Email] IN VALUES ( 'Data Input Table'[Participantemail] ) ) 
        )
    
    VAR _2 = IF ( NOT ( ISBLANK ( _3 ) ) , [_TotalParticipantPercentage], BLANK () )
    
    RETURN
    
    SWITCH ( 
        TRUE () , 
        ISBLANK ( _3 ) , "Yellow" , 
        _2 >= [DeptGoal] , "Green" , 
        _2 < [DeptGoal] && NOT ( ISBLANK ( _2 ) ) , "Red" , 
        "Yellow" 
    )
    

     

    Let me know if it needs adjustment.

     

    Thanks heaps,

    Theo