Forum Discussion

nex's avatar
nex
Regular Visitor
6 years ago
Solved

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?

  • 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

     

3 Replies

  • mahoneypat's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft Employee

    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

     

    • nex's avatar
      nex
      Regular Visitor

      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.