Forum Discussion

Dark_Bi's avatar
Dark_Bi
Regular Visitor
4 years ago
Solved

Filter Users that does not match both status

Hi, I am trying to filter users that are as "Status" only Concluded, but are not Active.

 

 

For example :

Paolo Pio was in a class Concluded but is also in a class Active so I should exclude it.

Carlo Tol Concluded two classes but is also Active in one class so I should exclude it.

Mich Rovati was in a class concluded so it is ok for the result table

Gianni Cosati is in a class Active so it should be excluded

 

Correct Results

 

Do you know how to do it in Power Bi?

Thank you very much.

 

  • Hi Dark_Bi 

     

    Use this measure to filter your visuals:

    Measure = 
    Var _Status = filter(addcolumns(all('Table 1'),"ST",RELATED('Table 2'[Status])),[ST]="Active")
    Var _A = SUMMARIZE(_Status,[Last name])
    return
    if(MAX('Table 1'[Last name]) in _A,1,0)

     

    Output:

     

     

    Download the attached file.

     

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

    Appreciate your Kudos!! 

    LinkedIn | Twitter | Blog | YouTube 

5 Replies

    • Dark_Bi's avatar
      Dark_Bi
      Regular Visitor

      Is it ok?

       

      Table 1      
      User idNameLast nameClass ID   
      1PaoloPio2   
      1PaoloPio6   
      2MarioMeol7   
      3CarloTol5   
      3CarloTol7   
      3CarloTol8   
      4MichRovati6   
      5GianniCosati9   

       

      Table 2 
      Class IDStatus

      2

      Active
      3Concluded
      4Concluded
      5Active
      6Concluded
      7Concluded
      8Concluded
      9Active
      • VahidDM's avatar
        VahidDM
        Icon for Super User rankSuper User

        Hi Dark_Bi 

         

        Use this measure to filter your visuals:

        Measure = 
        Var _Status = filter(addcolumns(all('Table 1'),"ST",RELATED('Table 2'[Status])),[ST]="Active")
        Var _A = SUMMARIZE(_Status,[Last name])
        return
        if(MAX('Table 1'[Last name]) in _A,1,0)

         

        Output:

         

         

        Download the attached file.

         

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

        Appreciate your Kudos!! 

        LinkedIn | Twitter | Blog | YouTube 

  • Dark_Bi's avatar
    Dark_Bi
    Regular Visitor

    Is it ok?

     

    Table 1      
    User idNameLast nameClass ID   
    1PaoloPio2   
    1PaoloPio6   
    2MarioMeol7   
    3CarloTol5   
    3CarloTol7   
    3CarloTol8   
    4MichRovati6   
    5GianniCosati9   

     

    Table 2 
    Class IDStatus

    2

    Active
    3Concluded
    4Concluded
    5Active
    6Concluded
    7Concluded
    8Concluded
    9Active