Forum Discussion
Basket Analysis with Power BI
- 7 years ago
No problem.
Here is a very simple PBIX which I hope helps with setting up this sort of data model.
The steps I followed were:
- Create the table ProjectParticipation (usine Enter Data in this case) which is the table you originally posted.
- Created a Company dimension table by referencing ProjectParticipation and grouping by the Company column. (You could equally create this from an independent list of Companies.)
- Created a 'Filter Company' table by referencing Company, and renaming the Company column to Filter Company.
- Created relationships as follows:
- Created the measure Projects with Both Companies:
Projects with Both Companies = CALCULATE ( DISTINCTCOUNT ( ProjectParticipation[Project] ), CALCULATETABLE ( SUMMARIZE ( ProjectParticipation, ProjectParticipation[Project] ), ALL ( Company ), USERELATIONSHIP ( ProjectParticipation[Company], 'Filter Company'[Filter Company] ) ) )This uses the pattern from DAX Patterns. - Created a basic report page with slicers on Company[Company] and 'Filter Company'[Filter Company]:
- The above shows that Company 1 & Company 3 have one project in common. You could combine this measure with others to show, for example, what fraction of Company A's projects were shared with Company B (some examples on DAX Patterns).
Hopefully that's useful. Please post back if needed :)
Regards,
Owen
OwenAuger Thank you for that.
I feel that the steps provided in the link on daxpatterns Basket analysis is already a jumpstart for me. However, being not familiar enough, I would hope for a bit more beginner-style guidance on how to generate the filter tables first.
Adopting my data to the example from the link you shared, the displayed report could not create the tables due to some error in the data tables.
Any additional help - thanks in advance!
Bests,
Nick
No problem.
Here is a very simple PBIX which I hope helps with setting up this sort of data model.
The steps I followed were:
- Create the table ProjectParticipation (usine Enter Data in this case) which is the table you originally posted.
- Created a Company dimension table by referencing ProjectParticipation and grouping by the Company column. (You could equally create this from an independent list of Companies.)
- Created a 'Filter Company' table by referencing Company, and renaming the Company column to Filter Company.
- Created relationships as follows:
- Created the measure Projects with Both Companies:
Projects with Both Companies = CALCULATE ( DISTINCTCOUNT ( ProjectParticipation[Project] ), CALCULATETABLE ( SUMMARIZE ( ProjectParticipation, ProjectParticipation[Project] ), ALL ( Company ), USERELATIONSHIP ( ProjectParticipation[Company], 'Filter Company'[Filter Company] ) ) )This uses the pattern from DAX Patterns. - Created a basic report page with slicers on Company[Company] and 'Filter Company'[Filter Company]:
- The above shows that Company 1 & Company 3 have one project in common. You could combine this measure with others to show, for example, what fraction of Company A's projects were shared with Company B (some examples on DAX Patterns).
Hopefully that's useful. Please post back if needed :)
Regards,
Owen