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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
H_insight
Helper V
Helper V

Dax to count Available Stock based on Demand

Hi,

 

I am trying to have a DAX measure to:

 

1- calculate the total stock at the beginning of selected date where stock status = Delivered per region.

2- calculate total demand per selected date

 

Stock table:

H_insight_0-1652098042276.png

Demand Table:

H_insight_1-1652098071737.png

 

Sample file

Many thanks

1 ACCEPTED SOLUTION
Whitewater100
Solution Sage
Solution Sage

Hi:

I added some dimension tables. I hope this is what you are looking for!

https://drive.google.com/file/d/1Rx0tlNTWIi6xzTtYEPhUdYTY_jDQ-k6G/view?usp=sharing 

Whitewater100_0-1652101981481.png

 

View solution in original post

5 REPLIES 5
Whitewater100
Solution Sage
Solution Sage

Hi:

I added some dimension tables. I hope this is what you are looking for!

https://drive.google.com/file/d/1Rx0tlNTWIi6xzTtYEPhUdYTY_jDQ-k6G/view?usp=sharing 

Whitewater100_0-1652101981481.png

 

Hi @Whitewater100  ,

 

Thanks for the quick response. Further to your solution, how can I view the remaining product balance in stock after that date?

 

For example, in the date range of 10/06/22 to 23/06/22 I had only 40 products (Status = Delivered):

 

H_insight_0-1652109821941.png 

H_insight_4-1652114003036.png

 

 and the demand was 94 . So I am short by 54 products based on that date range for that specific region. So far so good, but I trying to get the balance beyond  23/60/22? Let's say data range from 24/6/22 to 30/6/22 with a new total demand of 47, that will increase the gap to (54 +47) =101, unless new products were Delivered. Not sure if it's possible or not.

 

H_insight_3-1652113914977.png

 

Updated file link

 

Many thanks for your help.

 

Hi:

I think you want to match on your product ID's? What do the ID's represent? There is many id's and multiple regions for Product 1.  It looks like you may be comparing deliveries for 9&10 vs Demand for different products? 

 

To answer the questions you can try doing a ytd measure for both. Please see attached link.

https://drive.google.com/file/d/1Rx0tlNTWIi6xzTtYEPhUdYTY_jDQ-k6G/view?usp=sharing 

You can add a YTD calculation if this is only one product under discussion.

 

YTD Stock(Delivered) = TOTALYTD([Stock(Delivered)],'Date'[Date])
I hope the two questions are answered now...

1- calculate the total stock at the beginning of selected date where stock status = Delivered per region.

2- calculate total demand per selected date

 

Whitewater100_0-1652124178907.png

 

 
 

Thanks for heping with the extra mile 🙂

You are welcome. Have a nice week ahead..

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors