This project has moved and is read-only. For the latest updates, please go here.

Access & Edit Measure Descriptions (Powershell- AMO)

Topics: Standing Discussions
Nov 8, 2015 at 5:06 PM
Edited Nov 8, 2015 at 5:07 PM

Sorry if this question is not relevant for this discussion forum.
Would be great if I could get some input on the possibility to edit the Measure descriptions using AMO-Powershell. When I try to list the measures, only the _Count measure is displayed.

$mg = $cube.MeasureGroups.FindByName("XYZ Properties")
foreach ($measure in $mg.Measures.GetEnumerator())
Write-Host  $measure.Name.toString()   
Output: _Count XYZ

Thanks & Regards
Nov 8, 2015 at 10:06 PM

This is not really the right forum for this sort of question, it's usually better to ask general questions about SSAS on the MSDN forums here as there are more people that can help. This forum is really meant for discussions about the BIDS Helper plugin.

However AMO is a bit of a specialty of mine, so I'm happy to help out with this. In tabular there are no measures stored in the measure group object. All measures are calculations and are stored in the MDX Script. The descriptions for the measures in a tabular cube are stored in the CalculationProperties collection. The following PowerShell is an example of editing a tabular description and saving it back to the server.
$svrName = "localhost"
$sourceDB = "AdventureWorks"

# load the AMO and XML libraries
[System.Reflection.Assembly]::LoadwithpartialName("Microsoft.AnalysisServices") > $null

# connect to the AS Server
$svr = New-Object Microsoft.AnalysisServices.Server

$db = $svr.Databases["AdventureWorks"]
$cube = $db.Cubes[0]

$cube.MdxScripts[0].CalculationProperties["[Internet Total Sales]"].Description = "TEST DESCRIPTION Internet Total Sales"

Nov 9, 2015 at 11:37 AM
Great! Thanks a lot :)