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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Twin18
Regular Visitor

Stock date history from one table

Hello,

 

I need to make an report concering article stock history.

The problem is that there is only 1 table, and this table contains only mutations per article per date.

 

So i need to figure out how to pull historic data by searching in the same table multiple times.

For now i have figured out how to find the last month date containing stock data, but i can't seem to find a solution to pull the storage data value from that date.

 

i've made an datatable with autocalendar() to get a complete date range, but as you can see not everyday has an stock record.

 

Data source preview (articlenumber is not shown).

The last stock data is the following measure 

Last stock date prev. month = CALCULATE(MAX(Stockdata[Bookdate]);PREVIOUSMONTH(DateTable[Date]))

 

BI preview.png

So how can i use this date to make an new measure to show the stock on that exact date? 

 

Regards.

5 REPLIES 5
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Twin18,

Based on my test, you could use below formula to get the previous month stock value:

Last stock date prev. month = CALCULATE(MAX('Table1'[Stock]),PREVIOUSMONTH(Calender[Date]))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for you're response.

 

I think this is the right way, the only problem now is to only get the stock for the right article (every article has his own stock records.

Hi @Twin18,

It's pleasant that your problem has been solved, could you please mark the reply as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thim
Resolver V
Resolver V

Does it only contant 1 stock?

 

Could you use a lookupvalue, using the last stock date prev. month?

 

Something like this.

 

stock value prev. month = LOOKUPVALUE(Stockdata[Stock];Stockdata[Date];DateTable[last stock date prev. month])

 

 

Twin18
Regular Visitor

It contains stock from multiple articles, so when i create that measure i get the 'a table with multiple values was supplied..' error. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors