If then else statement on weekly granularity

joslaz

Board Regular
Joined
May 24, 2018
Messages
76
Hello everybody!

I have the following two tables:
tblInventory
ArticleValueDate (Today)
AA1500007.12.2019

tblChanges
ArticleValueDate
AA1-50006.10.2019
AA1250005.11.2019

The tblInventory shows the current inventory level.
The tblChanges shows the different positive and negative bookings for each day.

Know I need a measure, that shows me for the current week the actual inventory from tblInventory and for last week the actual inventory (tblInventory) - Value (tblChanges).

How would you do that?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Lets rename first sheet as "inventory" like this:
Noarticlevalue
1A130
2A225
3A315
In row "value" there is formula " =SUMIF(changes!$B$2:$B$2000,B2,changes!$C$2:$C$2000) "

Second sheet named "changes" looks like this:
Noarticlevaluesdate
1A150
2A1-20
3A230
4A315
5A2-5
Here you can make changes for the articles.

I didn't understand what do you want with dates, can you explain again with an example?
 
Upvote 0
How many rows does tblInventory have? e.g. a single weekly value or a daily value? My question is which table to go against - if tblInventory has the actual inventory for each day such that the sum of all daily changes in tblChanges is the difference from the previous row's value in tblInventory, then you can do the measure just against tblInventory (i.e. Today's tbleInventory[Value] - DATEADD(tblInventory[Value], -7, DAY)

And do you have a separate date table?

Since you may have Article AA1 multiple times in tblInventory you can't do a 1:many relationship with tblChanges, so RELATED functions probably won't work.
 
Upvote 0
tblInventory has 3 columns. Number, name of the article and current value of that article. Which means you know how much sugar, for example, do you have in market.

Why do you need article AA1 multiple times in tblInventory? If you have different types of sugar, let them be different articles.

I didn't understand what is purpose of date in tables. Do you just need to know when did you buy some articles or something more?
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,378
Members
448,955
Latest member
BatCoder

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top