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
Johnrevheim
Frequent Visitor

No items in stock based on in - out date

I have a need to visualize/count the number of items in stock day by day. I have an Excel spreadsheet with date in , date out and item description. How do I visualize this in a graphs showing each day and the number of each item ?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Johnrevheim,

 

Based on your description, you want to get the current  in-stock item, right?

If as I said, you can refer to below steps:

 

Tables(stock table, datetable):

Capture.PNG
 

Formula:
DateTable = CALENDAR(min(Stock[date-in]),MAX(Stock[date-out]))

 

Capture2.PNG

 

Measure:

 

InStock Item =
var currDate=MAX([Date])
var temp= ADDCOLUMNS(Stock,"range",CONCATENATEX(CALENDAR([date-in],[date-out]),[Date]&","))
return
LEFT(CONCATENATEX(FILTER(temp,ISERROR(SEARCH(currDate,[range]))=FALSE()),[item]&","),LEN(CONCATENATEX( FILTER(temp,ISERROR(SEARCH(currDate,[range]))=FALSE()),[item]&","))-1)

 

Create a calculate column to display the result:

 

Capture3.PNG
 

Notice: the result of temp table:

Capture4.PNG
 

If above is not help, please provide more detail information about your requirement.

 

Regards,
Xiaoxin Sheng

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @Johnrevheim,

 

Based on your description, you want to get the current  in-stock item, right?

If as I said, you can refer to below steps:

 

Tables(stock table, datetable):

Capture.PNG
 

Formula:
DateTable = CALENDAR(min(Stock[date-in]),MAX(Stock[date-out]))

 

Capture2.PNG

 

Measure:

 

InStock Item =
var currDate=MAX([Date])
var temp= ADDCOLUMNS(Stock,"range",CONCATENATEX(CALENDAR([date-in],[date-out]),[Date]&","))
return
LEFT(CONCATENATEX(FILTER(temp,ISERROR(SEARCH(currDate,[range]))=FALSE()),[item]&","),LEN(CONCATENATEX( FILTER(temp,ISERROR(SEARCH(currDate,[range]))=FALSE()),[item]&","))-1)

 

Create a calculate column to display the result:

 

Capture3.PNG
 

Notice: the result of temp table:

Capture4.PNG
 

If above is not help, please provide more detail information about your requirement.

 

Regards,
Xiaoxin Sheng

Hi @Anonymous,

 

for the same pattern data, could you please provide the solution , how to get the count of stock that is present in inventory right now and also solution to check the Stock present for previous months using a month year filter.

Ex: filter condition for stock

 Stock in date<=last day of the required month

                                   Stock out date(or sold date) >= first day of the next month or null. --Please let me know if this condition works for checking the stock count for previous months as well.

Michiel
Resolver III
Resolver III

If you're asking about the best visualization, I'd do this with a line chart, although the number of different items should not be too large.

Calculating the current stock works by calculating both the cumulative inflow and cumulative outflow. The data should start with an initial stock level to do this correctly. You can calculate the cumulative with e.g.

CumulativeIn = 
VAR EndDate = MAX(Calendar[Date])
RETURN
CALCULATE(SUM(StockTransactions[Amount]),
    FILTER(ALL(Calendar), Calendar[Date] <= EndDate)
    )

Sorry about the ignorance - new user. Do I add this formula as a new measure or new column?

Greg_Deckler
Community Champion
Community Champion

Please provide some sample data. Thanks.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

example data

 

date in        date out       item 

1.1.2016     2.2.2016         A

3.1.2016    15.1.2016        B

9.1.2016    10.2.2016        A

4.2.2016    10.2.2016        B

 

 

etc.

That's your only data? You don't have any inventory data or does each row represent 1 thing?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi,

yes. the data is structured like this. A is one type, B is one type etc. What I need to see on a time scale is how many of A, how many of B etc at any given date. 

 

Thanks for helping, 

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.