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
ozsoyozan
New Member

Warehouse daily stock calculation

Hello there;

I need your help on something.
I want to calculate the daily stock amount by using the daily amount of incoming and outgoing products in logistics warehouses.
What kind of formula should I write?

the calculation is as follows...
.example.png

 

thank you

have a nice day.

 

1 ACCEPTED SOLUTION

I can't read the columns in your dispatch and receding tables, so you will have to swap those out. 

place the Date[Date] column in your visual, then ther measure

 

=calculate(sum(receiving[in]) - sum(dispatch[out]),filter(all(Date),Date[date] <=max(Date[date])))



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

6 REPLIES 6

DAX is all about filtering. You need to filter the table so it keeps just the records you need. Something like

 

=calculate(sum(table[in]) - sum(table[out]),filter(all(table),table[date] <=max(table[date])))



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Dear Matt.

Thank you. but which table should I choose in "filter(all (table)"?
I could not fully understand.

I can't answer that question - you haven't provided any information about your tables. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

I have three separate tables. Date, Dispatch and Receiving. The Date table is related with other tables.image.png

I can't read the columns in your dispatch and receding tables, so you will have to swap those out. 

place the Date[Date] column in your visual, then ther measure

 

=calculate(sum(receiving[in]) - sum(dispatch[out]),filter(all(Date),Date[date] <=max(Date[date])))



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Dear Matt

This formula worked.

Thank you so much. 

Regards

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