Forum Discussion
Filter a column based on a value form another column
- 7 years ago
So you want to have it just showing those rows where column C is the same as column D? If so, just make a calculated column something like:
IsPreferredAddress = [Type] = [Person.PreferredAddresTypeId]
then filter that on true?
- Anonymous7 years ago
Anonymous
I took some liberties with test data I used for this, but I think my solution might help.
I have the following tables imported in my model:
Person:
Id Type Name 1 2 Chuck 2 1 Adam Address:
Id Type Address 1 1 123 Schirra Court 1 2 456 Grissom Drive 2 1 213 Aldrin Circle 2 2 548 Pogue Way After importing them into PBI, I used the following table expression to create a new table that pulled in the preferred address for each person:
SUMMARIZE Table = SUMMARIZE( Person, Person[Id], Person[Type], Person[Name], "Preferred Address", CALCULATE( SELECTCOLUMNS('Address',"Address",'Address'[Address]), FILTER( 'Address', 'Address'[Type] = Person[Type] ) ) )DAX with created tableHope this helps!Click HERE for the PBIX file.
CIick HERE for my address excel sheet.
Click HERE for my person excel sheet.
Anonymous
I took some liberties with test data I used for this, but I think my solution might help.
I have the following tables imported in my model:
Person:
| Id | Type | Name |
| 1 | 2 | Chuck |
| 2 | 1 | Adam |
Address:
| Id | Type | Address |
| 1 | 1 | 123 Schirra Court |
| 1 | 2 | 456 Grissom Drive |
| 2 | 1 | 213 Aldrin Circle |
| 2 | 2 | 548 Pogue Way |
After importing them into PBI, I used the following table expression to create a new table that pulled in the preferred address for each person:
SUMMARIZE Table =
SUMMARIZE(
Person,
Person[Id],
Person[Type],
Person[Name],
"Preferred Address",
CALCULATE(
SELECTCOLUMNS('Address',"Address",'Address'[Address]),
FILTER(
'Address',
'Address'[Type] = Person[Type]
)
)
)
Click HERE for the PBIX file.
CIick HERE for my address excel sheet.
Click HERE for my person excel sheet.