cancel
Showing results for 
Search instead for 
Did you mean: 

Macro Calulation - For week

Former Member
0 Kudos

Hi,

We have a requirement to sum a particular Key figure value only from Monday to Friday . We used the the standard function module Week_BDATE and Week_EDATE to get the week start date and end date of the week. But not sure how to pass this value to the key figure. Can anyone provide some inputs on this.

Find below the macro we have developed. But not sure if its correct.Can you please provide some inputs on this.

Sample Macro written for this is here :

Shipments:

Shipments : ( 1 Iterations : Initial ; Initial )

Row: R/3 Shipments ( Frm Initial ) =

SUM( WEEK_BDATE

(Row: R/3 Shipments ( Frm 03/26/2007 )

;

WEEK_EDATE(

Row: R/3 Shipments ( Frm 03/26/2007 )

)

Accepted Solutions (0)

Answers (2)

Answers (2)

somnath_manna
Active Contributor
0 Kudos

Hello,

Is the requirement to sum R/3 shipments done between Monday to Friday and put that value in Shipments keyfigure?

This will not be possible by the macro mentioned by you

Former Member
0 Kudos

Somnath,

We have a seperate shipments KF in the Planning area.We are pulling the Shipments from the R/3 to B/W and from there to APO SNP planning area.

Shipments value between R/3 and APO system will be in one day delay based on the load from BW.

From the SNP planning book we want to calculate Shipments value on a weekly basis only from Monday to Friday and display it in the Initial Column.

For Eg : Today we are in Tuesday(27th MAr) .In my SNP planning book i will have my Shippmentsd value only on Monday. I can calculate the week start date and week end date using standard functions.

If i execute the macro today using the standard function i wll calculate the start date as 26th Mar.How to pss this date to the Key igure and get the value from that ?

Valavan.B

Former Member
0 Kudos

BUCKET_BDATE() which will return you the beginning date of the period.

use this in another fucntion WEEKDAY() that will tell you the day of the week. (1 = monday)

You can use this to write into a auxilliary KF and use this as the basis for your macro

.

if the KF is greater than 5 ignore

Else if KF =1 add 5 days

if KF = 2 then add 4 days ...

....

if KF =5 then return just that days

somnath_manna
Active Contributor
0 Kudos

Hello Valavan,

I guess Harish has given you the macro function applicable to your case. Please let know if it helps or not. As I understand you are loading shipments data to SNP Planning Area to a Time-Series keyfigure (via BW) and not as Order Series data. Just curious - is the shipment data in BW having a specific day or date stamp or in a weekly bucket format. And what is the granularity in SNP Planning book - Day or Week.

Thanks,

Somnath

Former Member
0 Kudos

Harish,

Thanks for the inputs provided. I will try this option and will reach you in case if any issues.

Somnath,

BW we have the data in day / week / period format. My SNP planning area is defined in Day buckets. When i transfer the data from the BW Cube to the planning area it will get upadated in the time stamp available i.e Day bucket

Valavan.B

Former Member
0 Kudos

HI Valavan,

if your requirement is to sum values from monday to friday irrespective of the current day of that perticular week, then above may not help you...you may have to go for user defined function....this is my first impression....using standard macro functions, it may not possible to pass the dates to KF...like ROW: KF XXX(week_bdate())...etc....

the following may give you a good condition,

IF

weekday(today)

between 1 and 5

......

......

but how do you pass previous date to a ROW from current date...

i am curious about the solution, if you have already done it with a macro...

regards

uma

Former Member
0 Kudos

check if this helps