Looping in Power BI till it reach to certain condition

Dear Team,
Hope you are doing well :slightly_smiling_face:

Requesting you, please guide me on how I can achieve the logic in Power BI

I have sales data where there are three columns.
1st column is Month, which has the data type as a date.
2nd column is Sales, which is nothing, but Sales happened.
3rd column is Target, which is nothing, but Target decided.

I have written the logic in the attached Excel for which I am looking for the solution. And also pasted the screenshot of it here

I want this logic to implement in Power BI, where I have imported the attached Excel as source data.
PFA Excel & PBIX File
Sales Data.pbix (486.5 KB)
Sales Data.xlsx (13.5 KB)

How can we achieve it?? In Power Query by creating Looping Function or In DAX or In Calculated Column??

Much Appreciate all your help!!

Sales Data.xlsx (22.4 KB)
I had a play around in power query, its pretty complex logic and a lot going on, I added the table of my results to the right, what results are you expecting? It would be interesting to see if they matched with the expected results.

I also changed March to 18000 as your example to check that single result.

Hi @SAC

We’ve noticed that no response was received from you on the post above.

Just following up if you still require assistance to solve your inquiry.

In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved.

Hello @SAC

Due to your inactivity, we’ll be tagging this post as Solved.

Should you wish to provide supporting details, you can reopen this thread.

Thank you!

Hi Team,

Extremely sorry for the late reply.

I applied the solution provided by @kylie.oconnell , And it worked perfectly with the condition which I was expecting.
I was waiting for the User to test with their data and that is why got delay in replying.
Thank you so much @kylie.oconnell for the perfect solution!!! :+1:t2: :blush:

1 Like