patternsqlMinor
Getting formatted MDX values using OPENQUERY
Viewed 0 times
gettingmdxopenqueryformattedusingvalues
Problem
Is there any way to convert a value in MDX to a string using its
I have code similar to the following:
I am trying to get it to return formatted strings, instead of numeric values. The CSTR function doesn't seem to take the format string into account.
Converting them in SQL isn't an option here, because the rows have different format strings. It might be possible to convert them based on the titles of the rows, but I'd prefer to have SSAS do the work for me.
FORMAT_STRING?I have code similar to the following:
SELECT *
FROM OPENQUERY(DWDB001AS, '
WITH MEMBER [Measures].[ROH Total Sold Gross]
AS [Measures].[ROH Total Sold Dollars] - [Measures].[ROH Total Sold Cost]
,FORMAT_STRING=''Currency''
SELECT {
[Measures].[ROH Total Sold Gross]
} ON COLUMNS
FROM [ServiceDept]
')I am trying to get it to return formatted strings, instead of numeric values. The CSTR function doesn't seem to take the format string into account.
Converting them in SQL isn't an option here, because the rows have different format strings. It might be possible to convert them based on the titles of the rows, but I'd prefer to have SSAS do the work for me.
Solution
I ended up solving this using the
I'll keep the question open for a bit, in case anyone has a cleaner answer. I would have liked to pull the format string in from the calculated members, instead of hardcoding it, but I couldn't figure out how.
Format function, similar to the following:MEMBER [RO Count] AS Format([Measures].[ROH Count], "General Number")I'll keep the question open for a bit, in case anyone has a cleaner answer. I would have liked to pull the format string in from the calculated members, instead of hardcoding it, but I couldn't figure out how.
Code Snippets
MEMBER [RO Count] AS Format([Measures].[ROH Count], "General Number")Context
StackExchange Database Administrators Q#183869, answer score: 2
Revisions (0)
No revisions yet.