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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Mukombo
Regular Visitor

Stock at Hand from running total

Hello team,

I have 2 tables. 1 table has stock in dates when the stock was purchased. Another table has daily sales. On any given day, from the available stock on that date, I would like to know what is the balance. I am using a timeline visual. What is happening is when I choose a date from the timeline, it is giving me a balance as though nothing has been consumed in the past. This data is only for a few months and I cannot calculate the SAMEPERIODLASTYEAR. Attached is the PBIX file, Please help.

Thanks

 

https://drive.google.com/file/d/1sYbY0cKN1qSTpshkcn7XgkabW5r9j2Se/view?usp=sharing

 

PBIX File 

1 ACCEPTED SOLUTION

Dear aj1973,

We are almost there. The first screenshot is exactly how I want it. But you notice in the second screenshot when you select April, it is adding stocks for August too, which should not be the case. When I choose a month that is before August, I should only see stocks that were available within that period. And when I extend the period, it should look at what was available. When i select August, I need to add all stock received but should subtract the sales. Hope I am clearer

View solution in original post

6 REPLIES 6
aj1973
Community Champion
Community Champion

Hi @Mukombo 

Can you give me a screenshot on what is wrong and how you want the result to look like?

Also to use SAMEPERIODLASTYEAR you need relate the 2 tables

aj1973_0-1631447693467.png

 

However in your sales Table you don't have data from year 2020, how do you expect the formula to give you a result from the same period last year?

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Hi aj1973

 

I do not need THISSAMEPERIODLASTYEAR, Instead, I just want to look at what do i have available currently based on the selected date if I subtract what I have sold since the first day. Considering the dates when the stock was brought in. In the screenshot, when i choose April, the current balance is adding up the future stock as well, which shouldn't be the case, it should only look at the current stock on hand and less the previous sales stock. Likewise, when I choose the future date, it should add all stocks but subtract sales to that selected date.

Thanks

Stock at hand.PNG2.PNG

aj1973
Community Champion
Community Champion

Hi @Mukombo 

Is this how you want to see it!

aj1973_0-1631476265528.png

aj1973_1-1631476376831.png

 

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

aj1973
Community Champion
Community Champion

Hi @Mukombo 

Sorry but where do you see August when I select April!?

aj1973_0-1631538411514.png

Here is the file, check it out and let me know

https://drive.google.com/file/d/1TFoOZH9p3yNo1WihtNWt4gdTfQpaU4ew/view?usp=sharing

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Thanks a lot!

This is very helpful. Let me work with this. If I need further support, I will revert back

 

Dear aj1973,

We are almost there. The first screenshot is exactly how I want it. But you notice in the second screenshot when you select April, it is adding stocks for August too, which should not be the case. When I choose a month that is before August, I should only see stocks that were available within that period. And when I extend the period, it should look at what was available. When i select August, I need to add all stock received but should subtract the sales. Hope I am clearer

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors