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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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