Friday, March 23, 2012
median function
You would need some sort of CLR code to use it like AVG etc.
The SQL in the link below works (I translated it into Access SQL recently) however you will need to make minor modifications to account for nulls, not use the financial median etc.
http://www.oreilly.com/catalog/transqlcook/chapter/ch08.html
HTHsql
Monday, March 19, 2012
Measure data type from UDM to ADOMD
I need to get the data type of a measure in ADOMD.NET.
I have a SSAS project which deploys a cube. The measure is defined in this project file as having a FormatString of "Currency" (this is in the "Basic" section of the measure properties in Visual Studio).
I have tried to use the format_string property by using "
Code Snippet
CELL PROPERTIES FORMAT_STRING
", but this still returns "#, #" as the format string.How do I get the data type of the measure?
Thanks
hello,
MDSCHEMA_MEASURES schema rowset has DATA_TYPE column which contains measure's the data type.
In Adomd.net you can get to this information in 2 ways: either execute schema rowset request directly (with connection.GetSchemaDataSet method), or via metadata objects. Measure object has .Properties collection, and you can find the DATA_TYPE property in it. So Measure.Properties["DATA_TYPE"].Value should contain the data type of the measure. (i think you can compare the values with System.Data.OleDb.OleDbDataType enum values), for example i can test if measure's data type is returned as currentcy with something like this:
(UInt16)measure.Properties["DATA_TYPE"].Value == (UInt16)System.Data.OleDb.OleDbType.Currency
You should be able to get to Measure object either from .Measures colleciton exposed on cube, or by
cube.GetSchemaObject(SchemaObjectType.ObjectTypeMeasure, <unique name of the measure>) as Measure
hope this helps,