Forum Discussion
LOOKUPVALUE DAX with Many to Many relationship and multiple conditions
- 4 years ago
ezFlow , You can take one value or concatenate values
new column
maxx(filter(Roles , Roles [Department] = Access [Dept Name] && Roles [RoleTitle ] = Access [Roles ]) ,Roles[Role_ID])
or
concatenatex(filter(Roles , Roles [Department] = Access [Dept Name] && Roles [RoleTitle ] = Access [Roles ]) ,Roles[Role_ID], ", ")
ezFlow -
All "X" functions iterate over a table (Parameter 1), evaluating an expression (Parameter 2) for each row in that table.
MAXX just takes the max value of all the evaluated expressions over all the rows.
--THIS CODE GETS ONLY 1 VALUE
new column =
maxx( --MAXX ITERATES TABLE P1, PERFORMING EXPRESSION P2
filter( --P1: FILTER RETURNS A FILTERED SUBSET OF ROLES TABLE
Roles,
Roles [Department] = Access [Dept Name]
&& Roles [RoleTitle ] = Access [Roles ]
),
Roles[Role_ID] --P2: EVALUATES EXP ROLE_ID FOR EACH ROW IN P1
)
https://docs.microsoft.com/en-us/dax/maxx-function-dax
Hope this is helpful to you.
Nathan