cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Creating a dynamic matrix with same row and column names and calculated field values

Hi, 

 

I've got a table with item information. Each item has one row.

 

I want to create a matrix where the rows are still the items, and the columns are the items as well. The columns need to be dynamically added so when the data is updated and new items were added, new columns for the created items are added as well. 

 

The next step would be to add a calculation for each column and row, which counts sales orders of an other table where the item "a" of the row and the item "b" of each column are sold together. 

It should look like this:

ItemNo Chair  Table Lamp

Chairx25
Table2x6
Lamp56x

 

Does anyone have an idea how to do that?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Creating a dynamic matrix with same row and column names and calculated field values

To do this, you are likely going to need to make a second table that has your items column.  You will use the one from first table in rows or columns and the new one in the other.  This approach is explained on SQLBI as "Basket Analysis".  Please see this pattern explained there.  Note this is an older article from a time when the relationship filter arrows went the opposite direction.

 

https://www.daxpatterns.com/basket-analysis/

 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 

View solution in original post

3 REPLIES 3
Highlighted
Community Champion
Community Champion

Re: Creating a dynamic matrix with same row and column names and calculated field values

To do this, you are likely going to need to make a second table that has your items column.  You will use the one from first table in rows or columns and the new one in the other.  This approach is explained on SQLBI as "Basket Analysis".  Please see this pattern explained there.  Note this is an older article from a time when the relationship filter arrows went the opposite direction.

 

https://www.daxpatterns.com/basket-analysis/

 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 

View solution in original post

Highlighted
Super User IV
Super User IV

Re: Creating a dynamic matrix with same row and column names and calculated field values

@nex how your raw data looks like? You provided how you want the output to be but not what the raw data looks like? Sometimes the solutions can be totally different based on how raw data is available? Maybe there is a need of transformation before even data get used for the reporting purpose.

 

Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





Highlighted
Regular Visitor

Re: Creating a dynamic matrix with same row and column names and calculated field values

Hi @mahoneypat thanks for the reply. That is exactly what I was looking for.

Seems like i was making it more complicated than it actually is.

Thanks for the help!

 

@parry2k Thank you for the advise. I will keep it in mind the next time. 

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors
Top Kudoed Authors