Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Reversed loop over dates

Hi,

 

I'm trying to make a model that can predict if I can deliver a certain plant from stock. Lets say that the plant takes up 2 quantity of "Item 1". Then I want to make a revesed loop from the largest date which is the 30/07/2020 and stop when it is no longer possible to deliver the item which will be on the 30/05/2020. It means that my possible delivery date is the 15/06/2020 because from that date I can deliver all the dates in the future from the known data.

 

How do I make a measure that can poste this date for me?

 

                       Quantity                   Accumulated

                       Transaction              quantity

Stock                                                    40

15/05/2020          -13                           27

30/05/2020          -26                            1

15/06/2020           10                           11

30/06/2020           -3                             8

15/07/2020           -4                             4

20/07/2020           10                           14

30/07/2020           -5                             9

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    File attached. The code works the way you wanted... but I don't think you have considered all the possible arrangements of dates and quantities.

     

    Best

    D

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      Yeah it didn't solve it. The task I had seems to be difficult to solve with dax.

      It was solve using SQL instead.

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable
        It's not difficult to solve with DAX. Problem is you have not defined the full logic. But if your SQL works - great ๐Ÿ™‚

        Best
        D