on 05-13-2009 5:04 AM
Hi All,
I have a requirement like this.
My data in cube is like this.
SEASN BR DU ST PS VOL..
SS09 AD BB ST1 PS1 100
SS09 AD BB ST1 PS2 200.
SS09 AD BB ST2 PS3 300.
SS09 AD BB ST3 PS4 400.
i need to count the no.of PS under one ST i.e for ST1 the count should be 2 and for ST2 it should be1.
The fox formula thar we are using is ,
DATA DU TYPE ZDEVPUN.
DATA SR TYPE ZGSMSR.
DATA BR TYPE ZORBRANDS.
DATA PS TYPE ZPRODSPEC.
DATA SEASON TYPE ZSEANI.
DATA ST TYPE ZSOURCTYP.
DATA COUNTER TYPE I.
DATA PSA TYPE STRING.
DATA PSB TYPE STRING.
PSA = 'XXX'.
COUNTER =0.
FOREACH SEASON,BR,DU,SR,ST,PS.
PSB =ST.
IF PSA <> PSB AND PSA <> 'XXX'.
COUNTER =0.
ELSE.
COUNTER =COUNTER +1.
ENDIF.
PSA = ST.
ENDFOR.
but while executing this code PS is considering all four values i.e PS1,PS2,PS3,PS4 for ST1 and populating COUNTER with value 4.
Please provide any inputs for this problem.
Thanks in Advance.
Reshma.
Keep only PS and key figure name in fields to be changed and the remaining in field list. Write code as below. count = 0. Foreach PS. count = count + 1. Endfor. This will give you the count of PS for each combination of SEASN BR DU ST.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.