Answered by:
hiding a cube metric by using xmla script

-
Hi ,
I want to hide two measures in a cube by using Xmla script file .
Usually we send the modification by modifying the cube in visual studio solution and then generating the whole modified AS database XMLA script and then deploying on the target AS server.
I want to minimize the lines of code so that its easy to identify what was modified and with lesser impact to the cube .
PLease guide if there is any solution to this .
thanks in advance
Question
Answers
-
ok - I assumed you meant you wanted to modify an existing perspective using an xmla alter command - without referring to other objects (and less lines of code). If you want to set just a measure's visible property to false - <Visible>false</Visible> - you can still just list that measure group as it is also a "major object".
Example code is here (although for a data source instead of a perspective or measure group): http://msdn.microsoft.com/en-us/library/ms187152.aspx
Will that work?
Christian Wade
http://christianwade.wordpress.com/
Please mark correct responses as answers!- Proposed as answer by Elvis LongMicrosoft contingent staff, Moderator Wednesday, July 31, 2013 8:17 AM
- Marked as answer by Elvis LongMicrosoft contingent staff, Moderator Monday, August 05, 2013 4:36 AM
-
Here is some (abbreviated) sample code.
<Alter ObjectExpansion="ObjectProperties" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine"> <Object> <DatabaseID>Adventure Works Demo</DatabaseID> <CubeID>Adventure Works</CubeID> <MeasureGroupID>Fact Internet Sales 1</MeasureGroupID> </Object> <ObjectDefinition xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <MeasureGroup> <ID>Fact Internet Sales 1</ID> <Name>Internet Sales</Name> ... <Type>Sales</Type> <Measures> <Measure> <ID>Sales Amount 2</ID> <Name>Internet Sales Amount</Name> <DataType>Currency</DataType> <Visible>false</Visible> <Source> <DataType>Currency</DataType> <Source xsi:type="ColumnBinding"> <TableID>dbo_FactInternetSales</TableID> <ColumnID>SalesAmount</ColumnID> </Source> </Source> <DisplayFolder>mushu 1\Child Folder 1</DisplayFolder> <FormatString>Currency</FormatString> ... </Measure> </Measures> ... </MeasureGroup> </ObjectDefinition> </Alter>
Christian Wade
http://christianwade.wordpress.com/
Please mark correct responses as answers!- Proposed as answer by Elvis LongMicrosoft contingent staff, Moderator Wednesday, July 31, 2013 8:17 AM
- Marked as answer by Elvis LongMicrosoft contingent staff, Moderator Monday, August 05, 2013 4:36 AM
All replies
-
Hi,
To minimize the lines of code in the XMLA script, you can alter the existing perspective (without referring to everything else in the cube) because it is a "major object". See here: http://msdn.microsoft.com/en-us/library/ms187152.aspx=
However, if you are using tabular (not multidimensional), to easily identify what was modified (and optionally selecting only required modifications) with lesser impact to the model, see BISM Normalizer: http://visualstudiogallery.msdn.microsoft.com/5be8704f-3412-4048-bfb9-01a78f475c64
Christian Wade
http://christianwade.wordpress.com/
Please mark correct responses as answers!- Edited by Christian Wade Wednesday, July 24, 2013 3:58 PM
-
Hi Christian,
thanks for reply it is helpful .
Still I am looking for an example code where it's shown how a mesure can be hidden in the cube just by executing an alter command to the AS server.
Though whatever you have replied will definitely help .. but still Right now I am looking for a straight xmla to hide my measure in the cube using XMLA script.
thanks for the reply :)
-
ok - I assumed you meant you wanted to modify an existing perspective using an xmla alter command - without referring to other objects (and less lines of code). If you want to set just a measure's visible property to false - <Visible>false</Visible> - you can still just list that measure group as it is also a "major object".
Example code is here (although for a data source instead of a perspective or measure group): http://msdn.microsoft.com/en-us/library/ms187152.aspx
Will that work?
Christian Wade
http://christianwade.wordpress.com/
Please mark correct responses as answers!- Proposed as answer by Elvis LongMicrosoft contingent staff, Moderator Wednesday, July 31, 2013 8:17 AM
- Marked as answer by Elvis LongMicrosoft contingent staff, Moderator Monday, August 05, 2013 4:36 AM
-
Here is some (abbreviated) sample code.
<Alter ObjectExpansion="ObjectProperties" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine"> <Object> <DatabaseID>Adventure Works Demo</DatabaseID> <CubeID>Adventure Works</CubeID> <MeasureGroupID>Fact Internet Sales 1</MeasureGroupID> </Object> <ObjectDefinition xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <MeasureGroup> <ID>Fact Internet Sales 1</ID> <Name>Internet Sales</Name> ... <Type>Sales</Type> <Measures> <Measure> <ID>Sales Amount 2</ID> <Name>Internet Sales Amount</Name> <DataType>Currency</DataType> <Visible>false</Visible> <Source> <DataType>Currency</DataType> <Source xsi:type="ColumnBinding"> <TableID>dbo_FactInternetSales</TableID> <ColumnID>SalesAmount</ColumnID> </Source> </Source> <DisplayFolder>mushu 1\Child Folder 1</DisplayFolder> <FormatString>Currency</FormatString> ... </Measure> </Measures> ... </MeasureGroup> </ObjectDefinition> </Alter>
Christian Wade
http://christianwade.wordpress.com/
Please mark correct responses as answers!- Proposed as answer by Elvis LongMicrosoft contingent staff, Moderator Wednesday, July 31, 2013 8:17 AM
- Marked as answer by Elvis LongMicrosoft contingent staff, Moderator Monday, August 05, 2013 4:36 AM