March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello! I have a bit of a complicated task.
We have a list of spare parts, each with one or more variants. Each Variant is compatible with a certan Product. Compatibility is either tested (Yes) or is under investigation (TBD)
Table1 Parts with variants
Part | Variant |
1 | 1.1 |
1 | 1.2 |
1 | 1.3 |
2 | 2.1 |
3 | 3.1 |
3 | 3.2 |
4 | 4.1 |
5 | 5.1 |
Table 2: Compatibility
Variant | A | B | C | D | E |
1.1 | Yes | TBD | TBD | Yes | |
1.2 | Yes | Yes | |||
1.3 | |||||
2.1 | Yes | Yes | TBD | ||
3.1 | TBD | ||||
3.2 | Yes | Yes | |||
4.1 | Yes | ||||
5.1 | Yes | TBD |
The task is to list compatible products for each part, regardless of the variant (e.g. If Part 1 has at least one variant compatible with product A, product A is listed in the compatible products column). A product shouldn't be in both Compatible and TBD column.
Expected results:
Part | Compatible Products | TBD |
1 | A; B; C; E | D |
2 | B; D | E |
3 | A; E | C |
4 | C | |
5 | B | D |
What I have done so far:
1. In Table Compatibility, Unpivoted Columns 3-5 and filtered out the blanks
2. Added 2 new columns
Part | Compatible Products | TBD |
1 | ||
1 | A; E | B; D |
1 | B; C | |
2 | B; D | E |
3 | A; E | C |
3 | E | C |
4 | C | |
5 | B | D |
Can someone please help me out? Thank you!
Thanks for the reply from Kedar_Pande.
Hi @alinamarinbadea ,
Based on the description of your problem, I reproduced your question and made some changes, hopefully this will fulfill your needs.Here are the exact steps:
1.Create relationships:
2.Create two new columns in the Compatibility table:
Part = RELATED('Parts with variants'[Part])
UpdatedTBD =
IF (
CONTAINSSTRING (
CONCATENATEX (
FILTER ( 'Compatibility', 'Compatibility'[Part] = EARLIER ( 'Compatibility'[Part] ) ),
'Compatibility'[Compatible],
","
),
'Compatibility'[TBD]
),
BLANK(),
'Compatibility'[TBD]
)
3.Replace 'Compatibility'[variant] with 'Compatibility'[Part] and replace 'Compatibility'[TBD] with
4.The final result is as follows:
Best Regards,
Zhu
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you, @v-linhuizh-msft , it worked. However, I have two additional questions:
1. Is there any way to sort this column to say A; B; C; E on the first row instead than A; E; B; C ?
2. How would I adapt the formula if the relationship between tables is many to many (one variant can go in multiple parts)
Can anyone assist here please?
I don't have the column Part in the Compatibility Table.
Thied to adapt the formula for the CompatibleProducts table but the result is not the expected one
Table for Compatible Products:
CompatibleProducts =
ADDCOLUMNS(
SUMMARIZE('Table1 Parts with variants', 'Table1 Parts with variants'[Part]),
"Compatible Products",
CONCATENATEX(
FILTER(
SUMMARIZE(
'Compatibility',
'Compatibility'[Part], 'Compatibility'[Attribute],
"IsCompatible", MAXX(FILTER('Compatibility', 'Compatibility'[Value] = "Yes"), 'Compatibility'[Attribute])
),
NOT(ISBLANK([IsCompatible]))
),
[IsCompatible],
"; "
)
)
Table for TBD Products:
TBDProducts =
ADDCOLUMNS(
SUMMARIZE('Table1 Parts with variants', 'Table1 Parts with variants'[Part]),
"TBD Products",
CONCATENATEX(
FILTER(
SUMMARIZE(
'Compatibility',
'Compatibility'[Part], 'Compatibility'[Attribute],
"IsTBD", MAXX(FILTER('Compatibility', 'Compatibility'[Value] = "TBD"), 'Compatibility'[Attribute])
),
NOT(ISBLANK([IsTBD]))
),
[IsTBD],
"; "
)
)
Create a Final Merged Table:
FinalResult =
ADDCOLUMNS(
SUMMARIZE('Table1 Parts with variants', 'Table1 Parts with variants'[Part]),
"Compatible Products",
LOOKUPVALUE('CompatibleProducts'[Compatible Products], 'CompatibleProducts'[Part], 'Table1 Parts with variants'[Part]),
"TBD Products",
LOOKUPVALUE('TBDProducts'[TBD Products], 'TBDProducts'[Part], 'Table1 Parts with variants'[Part])
)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
87 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |