Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Stair shaped matrix help

Hello, 

 

I have been struggling with this problem for a couple of days, and i really need help figuring it out. 

 

I need to make a matrix that looks like this:

 

 

 

 

 

 

 

 

 

All the blue lines cover sensitive information, but they are essentially just amounts, to do with purchases and sales. 

 

The tricky part is the calculations that need to be in each field. 

The horizontal months indicate the month of purchase and the vertical months (the columns) indicate the month of sale. 

So i.e. field 1 (row: August, column: August) shows the lot numbers that were both purchased and sold in August. Field 2 (row: August, column: September) shows the items bought in august and sold in September. 

 

Essentially the matrix shows how specific products are sold over time. So the calculations should look like this for each field:

 AugustSeptemberOktoberNovemberDecember
Augustpurchase amount (august) - sales amount (august)purchase amount (august) - sales amount (august) - sales amount (september)purchase amount (august) - sales amount (august) - sales amount (september) - sales amount (oktober)purchase amount (august) - sales amount (august) - sales amount (september) - sales amount (oktober) - sales amount (November)purchase amount (august) - sales amount (august) - sales amount (september) - sales amount (oktober) - sales amount (November) - sales amount (december)
September purchase amount (september) - sales amount (september)purchase amount (september) - sales amount (september) - sales amount (oktober)purchase amount (september) - sales amount (september) - sales amount (oktober)  - sales amount (November)purchase amount (september) - sales amount (august) - sales amount (september) - sales amount (oktober) - sales amount (November) - sales amount (december)

 

The important thing is that the sales are tied to the purchase date of the specific lot number. So for field 2 it shouldn't be all lot numbers sold in september, but only the lot numbers bought in august and sold in september. 

 

My data consists of:

 

Purchase table 

Columns: posting date, lot number, purchase amount. 

 

Sales table

Columns: posting date, lot number, sales amount. 

 

I also have a date table. 

 

I hope someone can help me, and the solutions could be using dax or power query or whatever, i just can't alter the source of the data. Please ask questions if something is unclear, i know it is a complicated request, and i did my best to explain it. 

 

Thank you in advance!

6 Replies

  • Anonymous 

    Please check the attached file. I created a sample dataset as per the details that you shared. I added two dates tables which you can use as filters as well to control the view and filter.

     

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you, i will check it out! 

      • Fowmy's avatar
        Fowmy
        Icon for Super User rankSuper User

        Anonymous 

        Sure and update your reply.

  • v-jingzhang's avatar
    v-jingzhang
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

     

    Has the problem been solved? If so, you may accept an appropriate post as the solution or post your own solution to help other members find it quickly. Thanks.

     

    Best Regards,
    Community Support Team _ Jing