cancel
Showing results for 
Search instead for 
Did you mean: 

How calculate the number of days in the month in srcipt logic?

former_member245036
Participant
0 Kudos

Dear all,

I want to write script logic . It calculate the number of days in the month. But i don't know write statement in my script logic?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Hi Hung,

Please explain, what do you mean by "calculate the number of days in the month"?

Do you have days in your YIME dimension?

How do you want to use the calculated value... etc...

Vadim

former_member245036
Participant
0 Kudos

Dear Vadim

Thank you for your reply,

I want number of day in a month.

Example: Month :07 year: 2014, it have 31 days.

I want to get value = 31 to calculate fomular in my script logic.

I have dimension TIME. How i can write my script logic??

Thanks again,

Former Member
0 Kudos

Hi Hung,

wouldn't it be easier if you simply added a property to your TIME dimension and entered the number of days for each month into that property.

BR,
Arnold

former_member186338
Active Contributor
0 Kudos

The easy way to have number of days in the month is to store this value in some combination of dummy members like:

TIME 2014.07

CATEGORY DUMMY

ENTITY DUMMY

ACCOUNT DAYS

AUDITID DUMMY

...

Value: 31

Then you can reference this value as a tuple expression:

([CATEGORY].[DUMMY],[ENTITY].[DUMMY],[AUDITID].[DUMMY],[ACCOUNT].[DAYS],[TIME].[2014.07])

Vadim

former_member186338
Active Contributor
0 Kudos

Hi Arnold,

I can't recommend using property to store number of days in the month - will be very hard to use this property value in calculations!!! Long and slow FOR/NEXT loops will be required.

Vadim

former_member245036
Participant
0 Kudos

I want to calculate automatic number of days in the month from only TIME dimension. But i don't input value days in DUMMY member or  added a property .Other way?

Thanks,

Hungth

former_member186338
Active Contributor
0 Kudos

Sorry Hung,

What do you mean by calculate??? You have months in your TIME dimension, not days! No data to calculate...

You have to store this value and DUMMY member is the best option.

Is it clear?

Vadim

former_member245036
Participant
0 Kudos

Dear Vadim,

I want write script logic for calculate number days in month. Not input. Other way?

Example:

I have TIME dimension member: 2014.07. Now, i want write script logic to result calculate = 31.

Can i write script logic?

Thanks,

hungth

Former Member
0 Kudos

Hi,

I think what Vadim is writing is that, based on the information BPC has available, there is no possibility to calculate the number of days per month in a script.

BR,

Arnold

former_member186338
Active Contributor
0 Kudos

There is no way to calculate this! You have to store this value (31) somewhere.

Script logic is very limited, you can only test some condition:

*WHEN TIME.MONTHNUM

*IS 1

*REC(EXPRESSION=%VALUE%/31,ACCOUNT=SOMEACCOUNT)

*IS 2

*REC(EXPRESSION=%VALUE%/30,ACCOUNT=SOMEACCOUNT)

...

*ENDWHEN

But if you store the number of days using dummy members:

*WHEN SOMEDIM

*IS *

*REC(EXPRESSION=%VALUE%/([CATEGORY].[DUMMY],[ENTITY].[DUMMY],[AUDITID].[DUMMY],[ACCOUNT].[DAYS]),ACCOUNT=SOMEACCOUNT)

*ENDWHEN

Vadim

former_member245036
Participant
0 Kudos

Thanks all

0 Kudos

This message was moderated.

Answers (1)

Answers (1)

0 Kudos

Sorry but I don't think this can be achieved by script logic.