Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
The following has been driving me crazy for the last couple of days and I can't seem to come up with a solution in DAX. Any help is appreciated.
I have a table of items with their types:
| ID | Type |
| ID1 | A |
| ID1 | B |
| ID1 | D |
| ID2 | X |
| ID2 | Y |
| ID3 | X |
| ID3 | Y |
| ID3 | Z |
and I have another table that shows what combination of types form each group:
| Types | Group |
| A | 1 |
| B | 1 |
| A | 2 |
| B | 2 |
| C | 2 |
| A | 3 |
| B | 3 |
| D | 3 |
| X | 4 |
| Z | 4 |
| X | 5 |
| Z | 5 |
| Y | 5 |
| X | 6 |
| Y | 6 |
How can I put something together that would check every type for each ID and, with every combination of those types, inform me which groups they could be part of (not all types have to be used). The expected result would be the following:
| ID | Type | Relevant Group(s) |
| ID1 | A | 1 & 3 |
| ID1 | B | 1 & 3 |
| ID1 | D | 1 & 3 |
| ID2 | X | 6 |
| ID2 | Y | 6 |
| ID3 | X | 4, 5 & 6 |
| ID3 | Y | 4, 5 & 6 |
| ID3 | Z | 4, 5 & 6 |
Alternivelty, if the specific groups can't be informed, a simple "Yes" to indicate that a possible group exists for the existing types will suffice.
I have been trying to get this to work with the following thought process (I haven't translated this into DAX because I still don't know how I can do the last part):
Many thanks in advance.
Solved! Go to Solution.
Relevant Group(s) =
VAR CurrentType = ItemTypes[Type] -- First Table in Question
VAR CurrentID = ItemTypes[ID] -- First Table in Question
VAR Groups =
VALUES ( TypesGroup[Group] ) -- Second Table in Question
VAR SameRows =
CALCULATETABLE (
VALUES ( ItemTypes[Type] ),
ItemTypes[ID] = CurrentID,
REMOVEFILTERS ( ItemTypes )
)
VAR SetIntersection =
FILTER (
Groups,
VAR Types =
CALCULATETABLE ( DISTINCT ( TypesGroup[Types] ) )
VAR RemoveRows =
EXCEPT ( Types, SameRows )
RETURN
COUNTROWS ( RemoveRows ) = 0
)
VAR Result =
CONCATENATEX ( SetIntersection, TypesGroup[Group], ", " )
RETURN
Result
@RyanHare92 There is no association between ID and the second table, so how do you identify that? Why ID2 X/Y have 6?
@AntrikshSharma Because group 6 is formed by X and Y and ID2 has both types X and Y.
Relevant Group(s) =
VAR CurrentType = ItemTypes[Type] -- First Table in Question
VAR CurrentID = ItemTypes[ID] -- First Table in Question
VAR Groups =
VALUES ( TypesGroup[Group] ) -- Second Table in Question
VAR SameRows =
CALCULATETABLE (
VALUES ( ItemTypes[Type] ),
ItemTypes[ID] = CurrentID,
REMOVEFILTERS ( ItemTypes )
)
VAR SetIntersection =
FILTER (
Groups,
VAR Types =
CALCULATETABLE ( DISTINCT ( TypesGroup[Types] ) )
VAR RemoveRows =
EXCEPT ( Types, SameRows )
RETURN
COUNTROWS ( RemoveRows ) = 0
)
VAR Result =
CONCATENATEX ( SetIntersection, TypesGroup[Group], ", " )
RETURN
Result
Worked like a charm! What a legend!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 24 | |
| 17 | |
| 9 | |
| 7 | |
| 6 |