Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Filter by two columns

Hi, I have a table with reservations like this: ReservationID Area Date Person 1 1st floor 01.11.2020 A 2 kitchen 02.11.2020 A 3 kitchen 03.11.2020 C 4 garden 01.11.202...
  • camargos88's avatar
    5 years ago

    Anonymous ,

     

    Try this measure:

    _Contact = 
    VAR _person = SELECTEDVALUE('Table'[Person])
    VAR _tblAreaDate = SELECTCOLUMNS(ADDCOLUMNS(SUMMARIZE(FILTER(ALL('Table'), 'Table'[Person] = _person), 'Table'[Area], 'Table'[Date]), "Combine", COMBINEVALUES(",", 'Table'[Area], 'Table'[Date])), "Combine", [Combine])
    VAR _tblMatch = CALCULATETABLE(
                    VALUES('Table'[Person]), FILTER(ALL('Table'), COMBINEVALUES(",", 'Table'[Area], 'Table'[Date]) in _tblAreaDate && 'Table'[Person] <> _person))
    
    
    RETURN CONCATENATEX(_tblMatch, 'Table'[Person], ",")
  • AlB's avatar
    5 years ago

    Hi Anonymous 

    1. Place [Person] in a table visual

    2. Create this measure and place it in the visual

     

    Primary contacts = 
    VAR datesAreas_ = SUMMARIZE ( Table1, Table1[Area], Table1[Date] )
    VAR currentPerson_ = SELECTEDVALUE ( Table1[Person] )
    VAR contacts_ =
        CALCULATETABLE (
            DISTINCT ( Table1[Person] ),
            datesAreas_,
            Table1[Person] <> currentPerson_
        )
    RETURN
        CONCATENATEX ( contacts_, [Person], ", " )

     

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers