Hi
There are a few things that could be improved.
I note that the Source and Target cubes only have one dimension in common, as well as the Source having an extra dimension.
You are reading from a cube that has one more dimension than the target but you are not specifying the source element in the A_VNO_T_Cas_M dimension
You need to create a subset on that. Presumably it needs to select the top level consolidation in that dimension as I am guessing that you just want the total for that dimension?
Using MDX is certainly one way of defining a subset. Here is another:
Code: Select all
vDim = A_VNO_T_Cas_M' ;
vSub = SubsetName;
vElem = Whatever the top level consolidation is called ;
IF( SubsetExists( vDim , vSub ) = 0 ) ;
SubsetCreate( vDim , vSub , 1 ) ;
ELSE ;
SubsetDeleteAllElements( vDim, vSub ) ;
ENDIF ;
SubsetElementInsert( vDim, vSub, vElem , 1 ) ;
When defining a view you should always specify the ExtractSkip values. The default values have changed over time so it is always best to specify them even if only for documentation. In your case, you probably need to set SkipCalcs (actually means skip consolidations) to 0 as you will need consolidated values from the extra dimension - A_VNO_T_Cas_M
vCube = SourceCube ;
vView = ViewName ;
IF( ViewExists( vCube, vView ) = 1 ) ;
ViewDestroy( vCube, vView ) ;
ENDIF ;
ViewCreate( vCube, vView, 1 ) ;
ViewExtractSkipZeroesSet ( vCube, vView, 1 ) ;
ViewExtractSkipCalcsSet ( vCube, vView, 0 ) ;
ViewExtractSkipRuleValuesSet ( vCube, vView, 1 ) ;
Your subset on G_Rada_Filter needs to change. With a view reading from consolidated levels, you will get every consolidated level which will give too many records and you cannot write to a consolidation.
It is probably best to define a permanent subset. In the Subset Editor just record yourself doing a Subset All followed by a filter for Level 0, and add on an A-Z sort You should get something like this:
Code: Select all
{TM1SORT( {TM1FILTERBYLEVEL( {TM1SUBSETALL( [A_VNO_G_Rada] )}, 0)}, ASC)}
Save the subset as A_VNO_G_Rada_base (Substitute 'base' for whatever makes sense in your language)
You then need to assign the subsets using this bit of code
vDim = 'A_VNO_G_Rada';
vSub = 'A_VNO_G_Rada_base' ;
ViewSubsetAssign( vCube , vView , vDim, vSub ) ;
vDim = 'A_VNO_T_Cas_M'';
vSub = SubsetName ;
ViewSubsetAssign( vCube , vView , vDim, vSub ) ;
vDim = 'A_VNO_M_Zdroj'';
vSub = SubsetName ;
ViewSubsetAssign( vCube , vView , vDim, vSub ) ;
You didn't show your Source tab so the following will ensure that the source is the temp view
DataSourceType = 'VIEW' ;
DatasourceNameForServer = vCube ;
DataSourceCubeView = vView ;
When writing to a cube, you should always clear data first
You therefore need to define a view on the target cube like this. In this case you do want to skip consolidations, since you will be writing at the base level and you cannot clear a consol anyway.
Code: Select all
vCube = 'TargetCube ;
vView = ViewName ;
IF( ViewExists( vCube, vView ) = 1 ) ;
ViewDestroy( vCube, vView ) ;
ENDIF ;
ViewCreate( vCube, vView, 1 ) ;
ViewExtractSkipZeroesSet ( vCube, vView, 1 ) ;
ViewExtractSkipCalcsSet ( vCube, vView, 1 ) ;
ViewExtractSkipRuleValuesSet ( vCube, vView, 1 ) ;
You will need to assign a subset for 'Marze' in the A_VNO_M_Marze_Mio dimension so that you only clear that part of the cube. You cannot re-use the subset created above as this is a different dimension - A_VNO_M_Marze_MIO. Just adapt the code that I provided above for creating the temp subset.
Then you do the following. The first statement turns off logging so you don't generate a large log file. The second clears the target area of the cube. This is so that if data changes, it does not get left around in the target cube.
Code: Select all
CubeSetLogChanges( vCube , 0 ) ;
ViewZeroOut( vCube , vView ) ;
In the Epilog put the following to turn logging back on again.
Code: Select all
CubeSetLogChanges( TargetCube , 1 )
Looking at your Variable names you seem to have a space in them but I cannot tell if the underscore has been lost in the image. They should have an underscore like your image of server explorer.
Your Data Tab is OK. However, if you subsitute the hard-coded 'Marze' with the variable A_VNO_M_Zdroj then it will be more flexible in future if you want to adapt this process to transfer something other than Marze. For example you could define a parameter for whatever Marze is, presumably a month, and reference that in the source and target subsets.
Regards
Paul Simon