DAX formula to consider a value in the next period

D Chan

New Member
Joined
Jun 27, 2013
Messages
1
Hi can anyone help me with the following formula for DS calculation:

Basically in excel, it works like this:
DS(this week) = Stock(this week) / Sales (next week) *7
If Sales (next week) is not available, then take this week's sales


However, I have difficulty converting this into DAX expression.
My data structure looks like below (1st 3 columns). I have added "DS result" below to show my desired results.


[TABLE="width: 192"]
<COLGROUP><COL style="WIDTH: 48pt" span=4 width=64><TBODY>[TR]
[TD="class: xl65, width: 64, bgcolor: transparent"]Week[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"]Stock[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"]Sales[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"]DS result[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]14.2013[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]100[/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]7[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]15.2013[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]100[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]100[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]7[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]16.2013[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]100[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]100[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]7[/TD]
[/TR]
</TBODY>[/TABLE]


Basically in week 14.2013, the DS should take Stock in 14.2013(ie100) / Sales in 15.2013 (ie 100) * 7 = 7
However, in week 16.2013, as there is no week 17.2013 Sales available, it should then consider same week ie week 17.2013 Sales to give the desired result of 7.

Can any one help?
Thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,223,952
Messages
6,175,595
Members
452,657
Latest member
giadungthienduyen

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