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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

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 3
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
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
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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.