Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Filter from 2 different columns

Hi Team,

I need to create a filter from 2 different columns.

I want a filter from Colum Active_Status and Inactive_Status.

I need to give user a filter with Available and Not Active.

 

IP AddressActive_StatusInactive_Status
10.214.168.41Available 
10.214.168.40Available 
10.214.168.42 Not Active
10.217.37.168 Not Active
10.217.37.162AvailableNot Active
  • If you only want Available and not active then create a column like this:

     

    Status Check = SWITCH(TRUE(),
    'Table'[Active_Status]="Available" && 'Table'[Inactive_Status]="Not Active","Available not active",blank())

     If you want Active, In Active and Available  and In Active create a column like this:

    Status Check = SWITCH(TRUE(),

    'Table'[Active_Status]="Available" && 'Table'[Inactive_Status]="","Available",

    'Table'[Active_Status]="" && 'Table'[Inactive_Status]="Not Active","Not Active",

    'Table'[Active_Status]="Available" && 'Table'[Inactive_Status]="Not Active","Available not active")

     

6 Replies

  • Hi Anonymous 

    Create a calculated column like this 

    Status Check = SWITCH(TRUE(),

    'Table'[Active_Status]="Available" && 'Table'[Inactive_Status]="","Available",

    'Table'[Active_Status]="" && 'Table'[Inactive_Status]="Not Active","Not Active",

    'Table'[Active_Status]="Available" && 'Table'[Inactive_Status]="Not Active","Available not active")

     

     

    Please accept this a solution if your question is answered 

    Appreciate a kudos !!

    • Anonymous's avatar
      Anonymous
      Not applicable

      jaideepnema ,

      thanks for the replay,

      I want only 2 in filter.

      1. Availble

      2. Not Active

  • Anonymous 
    change the DAX as given below:

    Status Check = SWITCH(TRUE(),

    'Table'[Active_Status]="Available" && 'Table'[Inactive_Status]="","Available",

    'Table'[Active_Status]="" && 'Table'[Inactive_Status]="Not Active","Not Active",

    BLANK())
     
     

    Please accept this a solution if your question is answered 

    Appreciate a kudos !!

    • Anonymous's avatar
      Anonymous
      Not applicable

      jaideepnema ,

      I want Available and Not active, if I chane the DAX for 

      Status Check = SWITCH(TRUE(),

      'Table'[Active_Status]="Available" && 'Table'[Inactive_Status]="","Available",

      'Table'[Active_Status]="" && 'Table'[Inactive_Status]="Not Active","Not Active",

      BLANK()).

       Irrespective of anything in Active_Status Column it should only pick Inactive.

      There may be case where it has 2 status in Each colum but I want only Available and Not_Active

      • jaideepnema's avatar
        jaideepnema
        Solution Sage

        If you only want Available and not active then create a column like this:

         

        Status Check = SWITCH(TRUE(),
        'Table'[Active_Status]="Available" && 'Table'[Inactive_Status]="Not Active","Available not active",blank())

         If you want Active, In Active and Available  and In Active create a column like this:

        Status Check = SWITCH(TRUE(),

        'Table'[Active_Status]="Available" && 'Table'[Inactive_Status]="","Available",

        'Table'[Active_Status]="" && 'Table'[Inactive_Status]="Not Active","Not Active",

        'Table'[Active_Status]="Available" && 'Table'[Inactive_Status]="Not Active","Available not active")

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous.

    You can also try to create a measure expression to compare with selections, then you can apply this on the visual level filter to filter records. 

    Applying a measure filter in Power BI 
    Notice: you need to use unconnected table fields as the source of filter or the filter effect will apply to your records before changes.

    Regards,

    Xiaoxin Sheng