Forum Discussion

mattiadiena's avatar
mattiadiena
Frequent Visitor
6 years ago
Solved

Tracking Logistic Movements with Power BI

Good Morning All,

 

I have a table that report all the movements of materials from goods receipt to consumption.

Material are organized in handling units and they can moves from one handling unit to another one. Each movement is stored in a table and for each movement the table reports the source handling unit and the destination handling unit.

During the transformation of the table, in order to manage data with power bi, i need to add a 'Reference' column that reports the original source handling unit.

For example, for the case below (Source Handling Unit/Destination Handling Unit):

 

I would like to insert a dynamic column that for each row reports 1002913303 that is the original handling unit which has been moved into 1002922587.

Can you help me please?? 

 

Thanks and regards,

Mattia 

 

8 Replies

  • You should be able to do that in Power Query. What have you tried so far?

  • dax's avatar
    dax
    Community Support

    Hi mattiadiena ,

    I am not clear about your requirement and your logic , if possible could you please explain it in details? Then I will try to test this in my environment.

    Please do mask sensitive data before uploading.

    Thanks for your understanding and support.
    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • mattiadiena's avatar
      mattiadiena
      Frequent Visitor

      Hi dax ,

      Thanks for your answer.

      Here below you can find an example of the table i would like to create (The fourth column is what i would like to obtain).

       

      Movement IDSource Handling UnitDestination HUOriginal Source HU
      1200582660620058266062005826606
      2200582660620058266062005826606
      3200582660620058266062005826606
      4200582660620058451742005826606
      5200584517420058451742005826606
      6200584517420058451742005826606
      7200584517402005826606
      8200584517402005826606
      9200584517402005826606
      11200584517402005826606
      13200582660820058266082005826608
      14200582660820058266082005826608
      15200582660820058266082005826608
      16200582660820058266082005826608
      17200582660820058266082005826608
      18200582660802005826608
      19200582660802005826608
      20200582660802005826608
      26200582661020058266102005826610
      27200582661020058266102005826610
      28200582661020058266102005826610
      29200582661020058533722005826610
      30200585337220058533722005826610
      31200585337220058533722005826610
      32200585337202005826610
      33200585337202005826610
      34200585337202005826610
      35200585337202005826610
      36200585337202005826610
      37200585337202005826610
      38200585337202005826610
      39200585337202005826610
      40200585337202005826610
      41200585337202005826610
      42200585337202005826610
      43200585337202005826610

       

      Each row refers to a specific movement, which is characterized by a source Handling Unit and a destination Handling Unit.

      There is always an unique original source handling unit and the movement can be beetween the same handling unit or to new handling units. Through i would like to insert a calculated column that, as the last column proposed above, reports for each row the original source handling unit number of that specific movement.

      For  example in the table above you can notice that the first three rows refers to movements beetween the handling unit 2005826606 and itself, for all rows the original source is 2005826606.

      The fourth row reports a movement from 2005826606 to 2005845174 (New Hansdling Unit), the original source remains 2005826606.

      From the fourth row the table report movents from handling unit 2005845174 to itself or to other destination, also for these cases the original source remains 2005826606.

      I need to insert the a column that, by analizing the movements contained in the table, automatically defines for each row the original source handling unit.

      In this way i could better analyze data and delete all the rows that are consequence of other handling unit.

       

      I hope you can help me.

      Thank you very much,

      Mattia

       

      • ToddChitt's avatar
        ToddChitt
        Super User

        The question makes sense. Something moves from A to B to C to D, and all along the way, you want each 'movement' to be able to report that A was the starting point of this journey.

        Questions: Is each Movement related to a Material ID or some other identifier? Also, is there something in the Movement table to indicate the ORDER in which they happened? Maybe a Date/Time stamp, or Movement ID?

        Assuming both answers are YES, then you should be able to do the following:

        * Duplicate your Movement table.

        * Do a Group By and get the FIRST Movement for each unique Material ID

        * Join that to the original Movement table (MERGE) on Material ID and Movement Date (or Sequence or whatever) to get the Source Handling Unit.

        * Back on your original query, MERGE it with the result from above on only Material ID, forget about the Date or Sequence, and pick up the Source Unit.

         

        Hope this helps.