Hello All
I would like to know that how could we sum up two variables and bring that value in to third element.
If we have sourceview than we could write
Nvalue=(CellGetN(Value, cube name, V1,'ABC',V3,V4)+(CellGetN(Value, cube name,v1,'cde',v3,v4));
If (V2@=klm);
CellputN=(NValue, cubename,v1,'klm',v3,v4);
I have text file from which i have to SUM UP the data of ABC and CDE. The obtained sum value i have to upload in to KLM.
How could i do it? (Same as above just source would be different - Instead of source view now it is text file as a data source)
Thanks
Dharav
How to sum up two variable values and bring in to one elemen
-
- MVP
- Posts: 1831
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: How to sum up two variable values and bring in to one el
If it is 2 columns in your text file you just add the 2 variables together.
If the value is in 1 column and the variable is derived by another column then you can just use CellIncrementN or a CellPutN with a nested CellGetN on the same cell to achieve the same result (dependent on version.)
Personally though I would probably just create the 2 variables as measures and then have a third measure that is the consolidation of the 2.
If the value is in 1 column and the variable is derived by another column then you can just use CellIncrementN or a CellPutN with a nested CellGetN on the same cell to achieve the same result (dependent on version.)
Personally though I would probably just create the 2 variables as measures and then have a third measure that is the consolidation of the 2.
Declan Rodger
-
- Regular Participant
- Posts: 193
- Joined: Wed Apr 02, 2014 6:43 pm
- OLAP Product: TM1
- Version: 10.2
- Excel Version: 2010
Re: How to sum up two variable values and bring in to one el
Hello Declanr
I have data in text file, so how could i write CellGetN as there is no cube to target. Source of data is text file.
I thought to include 2 elements in metro dimension outside the hierarchy and get the data in to this element normally and than
write nvalue=((CellGetN(,,,'ABC',))+(CellGetN(,,,'DEF',)));
IF V4@='ABC';
CellputN(nvalue,,,'ABC',)
Do you have other efficient thought than let me know? I would definitely try the CellincreamentN and update you
Thanks
Dharav Patel
Even i would like to go through with your personal approach in generic situation. Here I have ABC Metro in target cube which would get the sum of Metro ABC and DEF from source cube.declanr wrote:If it is 2 columns in your text file you just add the 2 variables together.
If the value is in 1 column and the variable is derived by another column then you can just use CellIncrementN or a CellPutN with a nested CellGetN on the same cell to achieve the same result (dependent on version.)
Personally though I would probably just create the 2 variables as measures and then have a third measure that is the consolidation of the 2.
I have data in text file, so how could i write CellGetN as there is no cube to target. Source of data is text file.
I thought to include 2 elements in metro dimension outside the hierarchy and get the data in to this element normally and than
write nvalue=((CellGetN(,,,'ABC',))+(CellGetN(,,,'DEF',)));
IF V4@='ABC';
CellputN(nvalue,,,'ABC',)
Do you have other efficient thought than let me know? I would definitely try the CellincreamentN and update you
Thanks
Dharav Patel
-
- MVP
- Posts: 1831
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: How to sum up two variable values and bring in to one el
So the variables in question aren't measures -
You can use:
Or the CellPutN/CellGetN combo can be replaced with CellIncrementN. That is what I meant by nesting a CellGetN.
Just make sure to clear the destination before starting the load.
Edit - and if you have a lot of these mappings you can create a dimension with what all the elements are in the source file, each having an attribute of what element they map to in the destination cube then just reference that in your incremental load.
Variable | Value |
ABC | 1000 |
DEF | 220 |
Code: Select all
If ( ( vVariable @= 'ABC' ) % ( vVariable @= 'DEF' ) );
CellPutN ( Value + CellGetN ( sCube, v1, v2, 'KLM' ), sCube, v1, v2, 'KLM' );
EndIf;
Just make sure to clear the destination before starting the load.
Edit - and if you have a lot of these mappings you can create a dimension with what all the elements are in the source file, each having an attribute of what element they map to in the destination cube then just reference that in your incremental load.
Declan Rodger
-
- Regular Participant
- Posts: 193
- Joined: Wed Apr 02, 2014 6:43 pm
- OLAP Product: TM1
- Version: 10.2
- Excel Version: 2010
Re: How to sum up two variable values and bring in to one el
Thank You Declanr
I did same. I create a small consolidation in to source with new element 123 where leaves are those two elements which should be combined with their amounts. I sent that 123 in to file and from other instance in TI process i replace 123 with target.
I would also try your other recommendation. Thanks for your time and input.
I did same. I create a small consolidation in to source with new element 123 where leaves are those two elements which should be combined with their amounts. I sent that 123 in to file and from other instance in TI process i replace 123 with target.
I would also try your other recommendation. Thanks for your time and input.
-
- Regular Participant
- Posts: 193
- Joined: Wed Apr 02, 2014 6:43 pm
- OLAP Product: TM1
- Version: 10.2
- Excel Version: 2010
Re: How to sum up two variable values and bring in to one el
Declanr
In data tab,
i have one if condition statement. Now when i am writing another if condition statement than it throws the error. I wrote same if statement with new TI (everything same as before without earlier if statement) than it worked as expected. I am writing seconf if statement for cellIncrementN TI function so i can not combine in earlier if statement.
Is there a way where, Data tab executes both IF statements and in the order. First if statement should execute first and second if statement should execute second and more important both if statement should get executed.
Thanks
Dharav Patel
In data tab,
i have one if condition statement. Now when i am writing another if condition statement than it throws the error. I wrote same if statement with new TI (everything same as before without earlier if statement) than it worked as expected. I am writing seconf if statement for cellIncrementN TI function so i can not combine in earlier if statement.
Is there a way where, Data tab executes both IF statements and in the order. First if statement should execute first and second if statement should execute second and more important both if statement should get executed.
Thanks
Dharav Patel
-
- MVP
- Posts: 1831
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: How to sum up two variable values and bring in to one el
Multiple IF statements work fine. Can you post the code that didn't work and the error message?dharav wrote:Declanr
In data tab,
i have one if condition statement. Now when i am writing another if condition statement than it throws the error. I wrote same if statement with new TI (everything same as before without earlier if statement) than it worked as expected. I am writing seconf if statement for cellIncrementN TI function so i can not combine in earlier if statement.
Is there a way where, Data tab executes both IF statements and in the order. First if statement should execute first and second if statement should execute second and more important both if statement should get executed.
Thanks
Dharav Patel
Declan Rodger
-
- Regular Participant
- Posts: 193
- Joined: Wed Apr 02, 2014 6:43 pm
- OLAP Product: TM1
- Version: 10.2
- Excel Version: 2010
Re: How to sum up two variable values and bring in to one el
Declanr
Thank You. It works. I had to set up one element before another in data source
Thank You. It works. I had to set up one element before another in data source