Showing posts with label expression. Show all posts
Showing posts with label expression. Show all posts

Monday, March 12, 2012

Newbie help needed with MDX expression

I have the following MDX Expression:

Code Snippet

select
{Measures.Members} on columns,
[AccountNumber].Members on rows
from
BudgetCube

This gives me a nice tabular output with both account numbers and measures in each row.

When I run the query in MDX sample application its work like a charm.

However when I run the query from SQL Server 2000 via a Linked Server like this:

Code Snippet

SELECT
*
FROM
OPENQUERY
(
SERVER_OLAP,
'
select
{Measures.Members} on columns,
[AccountNumber].Members on rows
from
BudgetCube
'
)

I get the following error:

Server: Msg 7358, Level 16, State 1, Line 1
Could not execute query. The OLE DB provider 'MSOLAP' did not provide an appropriate interface to access the text, ntext, or image column '[MSOLAP].[AccountNumber].[AccountNumber].[MEMBER_CAPTION]'.
OLE DB error trace [Non-interface error: Could not get a storage interface for BLOB the column: ProviderName='MSOLAP' TableName='[MSOLAP]', ColumnName='[AccountNumber].[AccountNumber].[MEMBER_CAPTION]'].

    How do I correct the error? I suspect I need to create a caption for AccountNumber?

    I would like to remove the "All AccountNumber" row from the result, how can I do this in MDX?

    I need to filter the results based on a Date Dimention, as a range how can I do this?

Thanks

1: was fixed via http://support.microsoft.com/kb/916287

Saturday, February 25, 2012

Newbie - Query convert money

I have been unsuccessful at getting this to display the way I want it to.
BOL says that convert(money, [expression] , 1) will display my sales figures
as 1,234,567.89. However the results for my query
SELECT TOP 100 PERCENT SalespersonID, convert(money, SUM(NetSales),1)
AS NetSales
GROUP BY SalespersonID
ORDER BY SalespersonID
returns the column NetSales as 1234567.89.
This is driving my boss crazy trying to determine whether the result is
$100,000 or $1,000,000.
Can someone explain this to me? The data type is already money, so I'm
wondering if it is just ignoring the convert...
I appreciate your help!Format at the client / presentation tier, because asking SQL Server to do
this is silly:
SELECT
'$'+REVERSE(SUBSTRING(REVERSE(CONVERT(VA
RCHAR(100),CONVERT(MONEY,money_colum
n),1)),1,100))
AS money_column
FROM table
"Chuck" <Chuck@.discussions.microsoft.com> wrote in message
news:B3584EDB-D8FA-422B-8A67-D2B45735E2ED@.microsoft.com...
>I have been unsuccessful at getting this to display the way I want it to.
> BOL says that convert(money, [expression] , 1) will display my sales
> figures
> as 1,234,567.89. However the results for my query
> SELECT TOP 100 PERCENT SalespersonID, convert(money, SUM(NetSales),1)
> AS NetSales
> GROUP BY SalespersonID
> ORDER BY SalespersonID
> returns the column NetSales as 1234567.89.
> This is driving my boss crazy trying to determine whether the result is
> $100,000 or $1,000,000.
> Can someone explain this to me? The data type is already money, so I'm
> wondering if it is just ignoring the convert...
> I appreciate your help!
>