The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Greeting,
I have a large database in which it is possible to identify related products based on: item number, group, item.
I tried to connect these items and now I want to make a table in which I will have data that are related products.
Example:
Car-12 appears in three places and its related products are visible.
I would like to have a unique table where for each item I have a list of its relatives.
The database is quite large, so I would like to ask for help on how to do it and make it optimal for use.
Thanks a lot in advance!
Solved! Go to Solution.
@mraka9 I wrote this calculated table:
Result =
SELECTCOLUMNS(
GENERATE(
ADDCOLUMNS(
VALUES('Table'[Item]),
"@List", CALCULATE(CONCATENATEX('Table', 'Table'[Summary data], ";"))
),
VAR _current_item = 'Table'[Item]
VAR _current_list = [@List]
RETURN
SELECTCOLUMNS(
FILTER(
VALUES('Table'[Item]),
'Table'[Item] <> _current_item
&& CONTAINSSTRING(_current_list, 'Table'[Item])
),
"Related item", 'Table'[Item]
)
),
"Item", 'Table'[Item],
"Related item", [Related item]
)
Maybe it will work on the full data, but on the sample I'm getting something else for Car -14.
The thing is, can you please explain why an item is a related item. For example, why car 14 has car 33 or ca4 69 as related?
@mraka9 can you share a sample data as a table here so I could copy paste it to PBIX
Thanks in advance
Item number | Group | Stavka | Item | Summary data |
10-1 | 1 | 1 | Car-12 | Car-12;Car-14 |
10-1 | 1 | 1 | Car-14 | Car-12;Car-14 |
10-1 | 1 | 2 | Bike-77 | Bike-77;Bike-99 |
10-1 | 1 | 2 | Bike-99 | Bike-77;Bike-99 |
20-1 | 1 | 1 | Car-12 | Car-12;Car-42;Car-33 |
20-1 | 1 | 1 | Car-42 | Car-12;Car-42;Car-33 |
20-1 | 1 | 1 | Car-33 | Car-12;Car-42;Car-33 |
20-1 | 2 | 1 | Mobile-444 | Mobile-444;Mobile-333 |
20-1 | 2 | 1 | Mobile-333 | Mobile-444;Mobile-333 |
30-1 | 1 | 1 | Car-12 | Car-12;Car-69;Car-777 |
30-1 | 1 | 1 | Car-69 | Car-12;Car-69;Car-777 |
30-1 | 1 | 1 | Car-777 | Car-12;Car-69;Car-777 |
@mraka9 I wrote this calculated table:
Result =
SELECTCOLUMNS(
GENERATE(
ADDCOLUMNS(
VALUES('Table'[Item]),
"@List", CALCULATE(CONCATENATEX('Table', 'Table'[Summary data], ";"))
),
VAR _current_item = 'Table'[Item]
VAR _current_list = [@List]
RETURN
SELECTCOLUMNS(
FILTER(
VALUES('Table'[Item]),
'Table'[Item] <> _current_item
&& CONTAINSSTRING(_current_list, 'Table'[Item])
),
"Related item", 'Table'[Item]
)
),
"Item", 'Table'[Item],
"Related item", [Related item]
)
Maybe it will work on the full data, but on the sample I'm getting something else for Car -14.
The thing is, can you please explain why an item is a related item. For example, why car 14 has car 33 or ca4 69 as related?
Thank you very much!
This is a genius solution.
You are right, the link is provided in the sample because of the smaller sample.
This is definitely the solution to my problem!
I hope it will also work on large amount of data!
Thanks again!
Greetings
@mraka9 my pleasure 🙂
Hey, check out my showcase report - got some high level stuff there. Sure you will find there a lot of cool ideas.
https://community.powerbi.com/t5/Data-Stories-Gallery/SpartaBI-Feat-Contoso-100K/td-p/2449543
Give it a thumbs up over there if you liked it 🙂
Thanks again!
I see you have great ideas in the report! I will definitely take a closer look!
Kind regards
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
109 | |
80 | |
77 | |
46 | |
39 |
User | Count |
---|---|
137 | |
108 | |
64 | |
64 | |
53 |