Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to create custom slicer on two columns?

Lets say I have two fields First Name and Last Name I want to be able to use a single filter and type my name and it should find multiple rows that match any of the rows that has either First Name matching my search criteria or Last Name. for example

First Name, Last Name, Amount
John, Smith,10
Mike,Tyler,30
Smith,Jones,45


So in a single search filter/slicer I want to be able to type Smith and get rows 1 and 3. Any help will be greatly appreciated.

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous ,

    You can follow the below steps to achieve it:

    1. Create a calculated column to get full name

    Full Name = CONCATENATE ( CONCATENATE ( 'Table'[First Name], " " ), 'Table'[Last Name] )​

    2. Create a Text Filter visual with new calculated column [Full Name] as filter

    You can also refer the solution in the following threads to achieve it.

    Filter table based on two columns

    How to filter on multiple columns

    Best Regards

    Rena

     

     

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    You can follow the below steps to achieve it:

    1. Create a calculated column to get full name

    Full Name = CONCATENATE ( CONCATENATE ( 'Table'[First Name], " " ), 'Table'[Last Name] )​

    2. Create a Text Filter visual with new calculated column [Full Name] as filter

    You can also refer the solution in the following threads to achieve it.

    Filter table based on two columns

    How to filter on multiple columns

    Best Regards

    Rena

     

     

  • Anonymous ,

    Create an independent table

    names = distinct(union(all(table[first Name]), all(table[last Name])))

     

    and have create measure  and use that with first name and last name
    measure =
    var _max = selectedvalue(names[first Name])
    return
    calculate(counrows(Table), filter(Table, table[first Name] = _max || table[Last Name] = _max))

  • Anonymous's avatar
    Anonymous
    Not applicable

    sort of this answers the question but would appreciate other replies
    combine first and last name into a new single column say Full Name and use it as a filter.