Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
nex
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
mahoneypat
Employee
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

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Employee
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

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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. 

@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



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


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.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.