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