on ‎2016 Oct 27 12:20 PM
Dear Experts,
I have one question to calculate accounts with different periods.
For example I would like to calculate the account 1422100 from the accounts 1422200 actual period - 1422200 period 12 last year.
I put the following logic script in default:
[ACCOUNT].[#1422100]=([ACCOUNT].[1422200],[TIME].[%TIME_SET%])-([ACCOUNT].[1422200],[TIME].[%YEAR%(-1).12])
The problem is, it takes everytime the time period 2015.12. For the periods in 2016 would it be ok, but for Periods in 2017, 2018 etc. it should takes 12.2016, 12.2017 etc., but it doesn´t.
Has anyone an idea how it works correctly?
Thanks and best regards
Daniel
Request clarification before answering.
For simultaneous send of multiple months of the same year:
//%TIME_SET% = 2017.07,2017.08
*SELECT(%YS%,[YEAR],TIME,ID=%TIME_SET%) // %YS%=2017,2017
*SELECT(%FM%,[ID],TIME,YEAR=%YS% AND PERIOD=JAN) // %FM%=2017.01
*WHEN ACCOUNT
*IS 1422200
*REC(EXPRESSION=%VALUE%-[TIME].[TMVL(-1,%FM%)],ACCOUNT=1422100) // TMVL(-1,%FM%)=TMVL(-1,2017.01)=2016.12
*ENDWHEN
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The script that will work correctly if single month data is sent (incorrect for multiple months):
//%TIME_SET% = 2017.07
*SELECT(%Y%,[YEAR],TIME,ID=%TIME_SET%) // %Y%=2017
*WHEN ACCOUNT
*IS 1422100
*REC(EXPRESSION=%VALUE%-[TIME].[TMVL(-1,%Y%.01)]) // TMVL(-1,%Y%.01)=TMVL(-1,2017.01)=2016.12
*ENDWHEN
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One more question for missunderstanding me with the single month data
I want to sent the values also for 2017.08 etc. so the calculation should be every month. But I send just data in each month for the actual reporting period.
One more question, I see just the Account 1422100 in the logic. But the calculation is as described 1422100 = 1422200 current period - 1422200 last year.12. I don´t see the account 1422200
So is the script right for what I mean?
Thanks
First of all, please read: https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues/
Please describe how script will be launched, what data is selected etc...
Second: MDX calculations are very slow, try to use WHEN/ENDWHEN instead. And your logic is based on special variable %YEAR%, containing current year only!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi DAniel,
%YEAR% will always return the current calendar year! It is a system defined variable! Instead try using TMVL function with *WHEN/ENDWHEN.
http://sapassets.edgesuite.net/sapcom/docs/2015/08/6cdcaf53-557c-0010-82c7-eda71af511fa.pdf
Regards,
JP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am sending data for a single month f.e. 2017.07 for account 1422200 Value: 100.
In Period 12.2016 I have on this account 1422200 the value 50.
As result I would like to have on the account 14422100 the value 50 (100 - 50) in Period 07.2017
I hope it is a little more clear what I want to calculate
Thanks and BR
Daniel
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.