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
Anonymous
Not applicable

How to Calculate Inventory Days Using DAX

Hi,

 

I am new to using Power BI and DAX functions. Appreciate if anyone could help me with this.

 

I want to calculate the Inventory Day of a list of materials (also categorise by MRP) based on the Inventory value captured at month end closing. For example, in end of May'21, the sum of Inventory value under category 1RL is $3170. I have the COGS record for the last 6 months (posting period 12, 1.. 5). So the calculation of Inventory Days = ($3170-$1451-$1489)/$1743*31days+30days+31days = 65 days.

 

Xiner_Lim_4-1622713304956.png

 

This is my Inventory Table and COGS Table in power BI.

Xiner_Lim_1-1622712775291.png

Xiner_Lim_3-1622712951372.png

 

I need the Inventory Days for each material as well as each MRP.

Appreciate any help, thanks in advance !

 

 

 

 

 

 

 

 

2 REPLIES 2
Anonymous
Not applicable

Hi @amitchandak , first of all thanks for the help, much appreciated !

 

The purpose of calculating the Inventory Days is to understand how many days of stocks we are holding versus the previous months COGS.  As you can see below, the coverage of the Inventory could varies instead of a fix 3 months. Example, for 1RL inventory it covers about 2 months+ (65 Days), for 4RL inventory it covers about 5 months (150 Days).

 

Xiner_Lim_0-1622719805792.png

 

I have added a Date table in my power BI and an example file link attached. I would love for your help here with the formula. Thanks once again.

 

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

 

amitchandak
Super User
Super User

@Anonymous , I am not able to get you formula completely. So I am giving measures you may need to get that with help from date table and time intelligence

 

 

example

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))

last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))


Rolling 2 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-2,MONTH))

Days of last three month = day(eomonth(today(),0)) + day(eomonth(today(),-1)) + day(eomonth(today(),-2))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.