Monthly Archives: February 2014

Copying Cube in same SSAS Solution/ Database

To start with, apologies to my friends and followers who keep an eye on the blog. It’s been a long time since I have written anything here. But I’ll try my best no gaps now on.

Requirement:

  • So it’s a small requirement of creating one more Cube in same SSAS Solution. New cube should be same as the cube we have in solution, after getting this copy we can whatever necessary change required.

Solution:

  • Yeah I know this shouldn’t be too difficult to implement but guess what, I was not able to find a small and easy way mentioned anywhere. So I am giving you most obvious two options:

a) COPY and PASTE

It as simple as they say. See the initial solution outline in Fig 1:

 InitialCubes

Once you copy the cube (fig 1) and tries to paste it (fig 2) it asks for a new name (fig 3) and finally you get a new cube solution (fig 4).

 Creating Cube CopyFig 1  Paste CubeFig 2
 Name Copy CubeFig 3  CubeCopyFig 4

b) Use CREATE XMLA

Connect to the cube using SSMS. Select the Cube you want to copy and Right-Click cube and select option Create XMLA for Cube.

 CreateXMLA

Once you get the Cube XMLA in front of you, update two tags only. below is the figure that shows “Before” we updated the query which is actual cube XMLA, then “After” we updated the query which is what changes we need to do. And the changes are new cube Name and ID.

 CubeXMLA

Execute your new query in SSMS and VOILA!! you get your new cube under same solution.

Now you can update this new cube for whatsoever reason you want.

But where is the climax here, What’s the point I am sharing this all, Is there anything interesting left in the post ??????? YES 🙂

When we created a copy of cube using second the Option; it creates the cube which you cannot process, which you can open at any BIDS solution.

So the learning is:

  • Cube created from a copy of older should have different PERSPECTIVEs. Two or more cubes in same Solution/ database cannot have same perspectives. So in first Option COPY/PASTE, new cube is created with new name and same Name changes are done to Perspectives automatically (you can observe in solution. So you might want to change the name as per your requirement for perspectives.In second Option CREATE XMLA, we need to find the Perspective names and IDs in code and update those with new names. And then job is done.
Advertisements