Forum Discussion
Filter by two columns
- 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], ",") - 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
You can use this measure expression in a table visual with your Person column to get the shown result. Replace Reservations with your actual table name. Note this has two CONCATENATEX functions. A virtual table is made for all the combinations of place and date for that person. The first concat combines all the people that overlapped in each place time with commas. The second concat combines those individual list into a full list separate by semi colons.
SamePlaceDate =
VAR thisperson =
MIN ( Reservations[Person] )
VAR summary =
ADDCOLUMNS (
SUMMARIZE (
Reservations,
Reservations[Area],
Reservations[Date]
),
"overlap",
CONCATENATEX (
CALCULATETABLE (
DISTINCT ( Reservations[Person] ),
Reservations[Person] <> thisperson
),
Reservations[Person],
", "
)
)
RETURN
CONCATENATEX (
summary,
[overlap],
"; "
)
Regards,
Pat