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
sflynn
Helper I
Helper I

Rotating Inventory - Unique Count

I'm looking to create a formula that would calculate the total individual itmes needed in a one month period based on a rotating inventory. Once the item has been returned it can be utilized again within the same month. My data set has numerous start and end dates with varying durations of use and ovewrlapping date ranges. Does anyone have any ideas on how with can be accomplished?

1 REPLY 1
artemus
Microsoft Employee
Microsoft Employee

You can start with a date table which will have one row per day in your table. Then you can add 2 column sto your main table which just has the day (not time) of when an item was check out and when it was checked back in (this is not necessary if your table only records the day it was checked in/out, but not the time). Next you would take the date table and join it with your invintory table on the day it was checked in, and in a seprate copy of the date table join on when it was checked out. Do a table expansion on each table, and add a new column inventory_quantity_update to  1 in the check in table, and -1 in the check out table. Do a union on both table, followed by a group by summing the inventory_quantity_update to get a table with the per day change of quantity per item.

 

Next, you need to calculate a cummalitive sum on the inventory_quantity_update column (make sure your table is sorted by date). While you can do this in Power query, it is much easier to do in DAX at the visualization layer using the quick measure Running total.

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.