Page 1 of 1
TI Process to increment value in a cell
Posted: Thu Dec 14, 2023 7:31 pm
by M1ndbender
I am building a TI process that looks for value at all the records at an intersection and increments another intersection by this value but I am not sure if I need to define a source and target view or if I can just do a calculation and if so how.
Source intersection
Cube - Sales
Period Dimension = All Periods
Location Dimension = Canada
Account Dimension = Account1
Product Dimension = Product1
Measure Dimension = Product1 Sales
So if for example a value returned for this is 60s, multiply those values by -1 (-60) and put them at the following intersection incrementing what is already there
Source intersection
Cube - Sales
Period Dimension = All Periods
Location Dimension = North America
Account Dimension = NA_Account1
Product Dimension = NA_Product1
Measure Dimension = NA_Product1 Sales
If this intersection has an existing value for the source intersection of 100 increment it by -60
I hope I am explaining this well enough
Re: TI Process to increment value in a cell
Posted: Thu Dec 14, 2023 9:32 pm
by Alan Kirk
M1ndbender wrote: ↑Thu Dec 14, 2023 7:31 pm
I am building a TI process that looks for value at all the records at an intersection and increments another intersection by this value but I am not sure if I need to define a source and target view or if I can just do a calculation and if so how.
As long as you can determine the target elements from the source elements, you don't need a target view... and more to the point the target view wouldn't help you anyway.
M1ndbender wrote: ↑Thu Dec 14, 2023 7:31 pm
Source intersection
Cube - Sales
Period Dimension = All Periods
Location Dimension = Canada
Account Dimension = Account1
Product Dimension = Product1
Measure Dimension = Product1 Sales
So if for example a value returned for this is 60s, multiply those values by -1 (-60) and put them at the following intersection incrementing what is already there
Source intersection
I presume that you mean
TARGET intersection there.
M1ndbender wrote: ↑Thu Dec 14, 2023 7:31 pm
Cube - Sales
Period Dimension = All Periods
I'm assuming that this is a consolidation of individual period elements. If so, you're stuffed at this point because you can't write numeric values to a consolidation. You would need to read from the individual periods and write to the individual periods.
M1ndbender wrote: ↑Thu Dec 14, 2023 7:31 pm
Location Dimension = North America
There could well be a similar problem there. Unless you have North America as an N level element, rather than a consolidation of Canada + US + Mexico, you won't be able to write to it. (Though you COULD add an N element like "NA_North_America" to hold values that you don't want to break out. You could do something similar under the All Periods consolidation.)
You would also need some way to tell the TI that you want Canada data written into the North America N element; one way of doing that would be to create a text attribute for elements like Canada that the process could look up.
M1ndbender wrote: ↑Thu Dec 14, 2023 7:31 pm
Account Dimension = NA_Account1
Product Dimension = NA_Product1
Measure Dimension = NA_Product1 Sales
If this intersection has an existing value for the source intersection of 100 increment it by -60
To my mind there is a more fundamental problem with your idea and it's this; how can you be ABSOLUTELY SURE that the process won't, intentionally or inadvertently, be run more than once? If it is, you'll end up with the values in the NA_x elements doubling, then tripling, then...
From what you've described you'd probably be far better off doing this as a rule rather than a TI so that as values are added into Account1, Product1,
Product1 Sales the negative value automatically goes into NA_Account1, NA_Product1, NA_Product1 Sales. That way it is real time (nobody has to remember to run the process) and there is no risk of a double up.
Re: TI Process to increment value in a cell
Posted: Sun May 12, 2024 8:57 am
by konstantin-spb
Nothing is clear, but so interesting…
Maybe you are looking for this solution:
ValueSrc = CellGetN(CubeSrc, e1, e2 [,...en]);
ValueTrgCurrent = CellGetN(CubeTrg, e1, e2 [,...en]);
CellPutN(ValueSrc + ValueTrgCurrent, CubeTrg, e1, e2 [,...en]);
or
ValueSrc = CellGetN(CubeSrc, e1, e2 [,...en]);
CellIncrementN(ValueSrc, CubeTrg, e1, e2 [,...en]);
And before “copying” the data, clear the slice in the target.