I hit the above error message when running the below query:
WITH
MEMBER [Measures].[LEVEL INSTANCE none:Date:qk - lev00] AS
'CASE WHEN IsEmpty([Dim Calendar].[Date].CurrentMember.MemberValue) OR [Dim Calendar].[Date].CurrentMember.MemberValue = null THEN null ELSE CDate([Dim Calendar].[Date].CurrentMember.MemberValue) END',
SOLVE_ORDER = 127
SELECT
{[Measures].[AvgSelectedCount],
[Measures].[AvgSelectedScore]} DIMENSION PROPERTIES [MEMBER_UNIQUE_NAME],[MEMBER_CAPTION] ON COLUMNS,
NON EMPTY [Dim Calendar].[Year].[Year].AllMembers DIMENSION PROPERTIES [MEMBER_UNIQUE_NAME],[MEMBER_CAPTION] ON ROWS
FROM [sqis]
WHERE
StripCalculatedMembers(CROSSJOIN(
Filter(
[Dim Calendar].[Date].[Date].AllMembers,
DATEADD("d",-365,DATEADD("d",DATEDIFF("d",CDate(36526),NOW()),CDate(36526))) <= [Measures].[LEVEL INSTANCE none:Date:qk - lev00] AND [Measures].[LEVEL INSTANCE none:Date:qk - lev00] < DATEADD("d",1,DATEADD("d",DATEDIFF("d",CDate(36526),NOW()),CDate(36526)))),
{[Dim Country Region Vendor].[Country].&[Italy]}))
Query (14, 5) Execution of the managed stored procedure DATEADD failed
with the following error:
Microsoft::AnalysisServices::AdomdServer::AdomdException. Deeply
nested recursive calculations cannot invoke a CLR Stored Procedure.
Execution complete
What is the meaning of the error and is there anything that needs to be set for DimCalendar Date properties in SSAS?
Related
Is there any equivalent of linkmemeber from MDX to DAX?
I am trying to migrate the following script from MDX to DAX
with
member TauxdetransformationQuartileRegion as ([Measures].[Taux_de_transformation_Region],[Bon Envoi].[Bon Envoi].&[True])
member Annees as [Date Creation].[Année].currentmember.name
select {
[Measures].[Tx_Real_Meilleur_Region]
,TauxdetransformationQuartileRegion
} on 0
FROM ( select strtoset(#Region) on 0 from test)
WHERE (
linkmember(strtotuple(#DateFin),[Mois Publication].[Mois de publication])
,{strtotuple(#DateDebut):strtotuple(#DateFin)}
,[Perimetre Ebusiness].[Périmètre E-Business].&[O]
,{[MER_Publication].[Detail Type Visiteur].&[Prospect],[MER_Publication].[Detail Type Visiteur].&[Client direct]}
,( - { [Origine_Marketing].[Entree Parcours].&[SiteAgent] } )
)
MDX query parameters are typically strings with member unique names ("[Dim].[Attr].&[Key]") which you must convert to a member with StrToMember(#Param). And if you need to switch hierarchies you the use LinkMember.
DAX parameters are just the values. So the parameter will work against any dimension. Thus LinkMember isn’t needed.
Here is an article about DAX parameters. For Date type parameters I forget if you just say 'Date'[Date] = #DateParam or if you have to say 'Date'[Date] = DATEVALUE(#DateParam). My recollection is that it depends on whether the parameter is Date type (use the first approach) or String type (use the DATEVALUE approach).
Below the MDX statement on icCube. (Note that icCube has a non-native language component, called function).
with function article_list() as topcount([Product].[Product].[Article], [amount], 10)
function benchmark_best_index2(i) as sum(order(topcount([Product].[Product].[Article], [amount], 10), [measures].[amount], desc).(i-1) , [measures].[amount])
// why doesnot the following function work?
function benchmark_best_index(list,i) as sum(order(list, [measures].[amount], desc).(i-1), [measures].[amount])
member [measures].[bm_top_amount_doesnotwork] as benchmark_best_index(article_list(),1)
member [measures].[bm_top_amount_doesnotwork_either] as benchmark_best_index( topcount([Product].[Product].[Article], [amount], 10),1)
member [measures].[bm_top_amount_works] as benchmark_best_index2(1)
select { [measures].[amount],[measures].[bm_top_amount_doesnotwork], [measures].[bm_top_amount_doesnotwork_either], [measures].[bm_top_amount_works]} on 0
,article_list() on 1
from sales
I cannot get the calculated measure [bm_top_amount_doesnotwork] and [bm_top_amount_doesnotwork_either] to work.
My idea is to have 2 generic functions, with the 2nd one calling the first one. The end result is a benchmark value that can be used for charts, calculations and so on.
I see this is not possible form the above stated MDX. But is it possible? And if YES, how?
We've to check in detail what went wrong (issue) in the meantime you can force the type of the parameter so the MDX parser knows it is a set :
sum(order( {list} , [measures].[amount], desc).(i-1), [measures].[amount])
I have a dynamically Stored Procedure, which create a mdx statement for a OpenRowset Query. So it can happen that the objects from the mdx statement are empty. In this case I want back an empty string
SQL Server gives me this error:
"The OLE DB provider "" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions on that object."
I tried different things (Catch Statement, sp_describe_first_result_set) but nothing was working...
How can I handle this error ? In my statement below ie. the customer 'Abbas' is not available...
SELECT A.* FROM OpenRowset('MSOLAP', 'DATASOURCE=.; Initial Catalog=CUBE','
SELECT
{[Dim Customer].[v Dim Customer Name].[Customer].&[Abbas]} *
{[Dim Salesperson].[Lastname].&[Fima 1]} *
{[Dim Creditcard].[v Dim Creditcard Cardtype].[Cardtype].&[Vista]} ON 0
FROM CUBE
WHERE [Measures].[total]
') as A
Please try putting measures on columns and dimensions on rows:
SELECT A.* FROM OpenRowset('MSOLAP', 'DATASOURCE=.; Initial Catalog=CUBE','
SELECT {[Measures].[total]} ON 0,
{[Dim Customer].[v Dim Customer Name].[Customer].&[Abbas]} *
{[Dim Salesperson].[Lastname].&[Fima 1]} *
{[Dim Creditcard].[v Dim Creditcard Cardtype].[Cardtype].&[Vista]} ON 1
FROM CUBE
') as A
I don't know ABCDs of MDX. I have this query that was handed over to me by my predecessor and that it is needed only once in a year! That time of the year happens to be now! The query runs and returns the results. However, I am unable to copy the result along with the rows and column names from the SSAS result window.
Googling I found the options of Linked servers, setting query options to save the result as csv etc, using SSIS packages and PowerPivot.
The first two are not possible because of restrictions on the DB. I need to go over a bunch of corporate hurdles to get the necessary permissions.
SSIS packages and Power Pivot - have the same issue. 'BUD' is a named set and it is referenced in the filter below in select statement. Both SSIS (when typed in OLEDB Source) throws error - The dimension [BUD] was not found.
Working with PowerPivot, I executed set create statement separately and then pasted only the code after 'WITH'. The Error was -The dimension [BUD] was not found.
Any help of how to reference the BUD in the select statement for Power Pivot or SSIS? I am using sqlsever2008r2.
This the procedure -
create set [DB1].BUD AS
nonemptycrossjoin(
{[Market].[Markets].&[Europe].children,[Market].[Markets].[Part of World].&[Africa].children},
[Product].[PL].&[CD] : [Product].[PL].&[KZ],
[Plant].[Plant].children
) go
with
member measures.callsCY1 as
/* Lot of measure calutaions here */
select
non empty
{
[Measures].[Qty Sold],
callsCY1,costCY1,MTRLcostCY1,LabourCostCY1,
SCR_C,callsRY1,costRY1,MTRLcostRY1,LabourCostRY1,
callsCY2,costCY2,MTRLcostCY2,LabourCostCY2,
callsRY2,costRY2,MTRLcostRY2,LabourCostRY2,
callsCY3,costCY3,MTRLcostCY3,LabourCostCY3,
callsRY3,costRY3,MTRLcostRY3,LabourCostRY3
}
*
{[Report Period].[Report Periods].[Quarter].&[2013-01-01T00:00:00] : [Report Period].[Report Periods].[Quarter].&[2014-06-01T00:00:00]}
on 0,
non empty
filter(
bud, [Measures].[Qty Sold] <> 0 OR [Measures].[QTY Service Calls] <> 0)
on 1
from [db1]
Does bud need to be seperate? Can't you just use this?
with
set [BUD] AS
nonemptycrossjoin(
{[Market].[Markets].&[Europe].children,[Market].[Markets].[Part of World].&[Africa].children},
[Product].[PL].&[CD] : [Product].[PL].&[KZ],
[Plant].[Plant].children
)
member measures.callsCY1 as
/* Lot of measure calutaions here */
select
non empty
{
[Measures].[Qty Sold],
callsCY1,costCY1,MTRLcostCY1,LabourCostCY1,
SCR_C,callsRY1,costRY1,MTRLcostRY1,LabourCostRY1,
callsCY2,costCY2,MTRLcostCY2,LabourCostCY2,
callsRY2,costRY2,MTRLcostRY2,LabourCostRY2,
callsCY3,costCY3,MTRLcostCY3,LabourCostCY3,
callsRY3,costRY3,MTRLcostRY3,LabourCostRY3
}
*
{[Report Period].[Report Periods].[Quarter].&[2013-01-01T00:00:00] : [Report Period].[Report Periods].[Quarter].&[2014-06-01T00:00:00]}
on 0,
non empty
filter(
bud, [Measures].[Qty Sold] <> 0 OR [Measures].[QTY Service Calls] <> 0)
on 1
from [db1]
First of all I use the SQL Management Studio for this query (no Excel 2007 that seems to have problems):
WITH
SET [Project period dates] AS
{
StrToMember("[Time].[Date].&[" + [Project].[ParentProject].CURRENTMEMBER.PROPERTIES("Project Start Iso") + "]"):
StrToMember("[Time].[Date].&[" + [Project].[ParentProject].CURRENTMEMBER.PROPERTIES("Project End Iso") + "]")
}
MEMBER [Measures].[Test] AS ([Project period dates].COUNT)
SELECT
{
[Measures].[Test]
}
on 0,
NONEMPTY ([Project].[ParentProject].MEMBERS)
DIMENSION PROPERTIES [Project].[ParentProject].[Project Duration], [Project].[ParentProject].[Project Start Iso], [Project].[ParentProject].[Project End Iso]
on 1
FROM
[MyCube]
WHERE
(
[Orgunit].[Orgunit].&[448]
)
This query delivers a list of projects with its three properties and a calculated member that is based upon my calculated set. The properties show the right values, but the calculated member shows always the same: the result of the very first project it should be calculated for.
I don't really understand why, because MSDN says:
The current member changes on a hierarchy used on an axis in a query.
Therefore, the current member on other hierarchies on the same
dimension that are not used on an axis can also change; this behavior
is called 'auto-exists'.
They give examples with calculated members, but I think that should also work with calculated sets, I have read that query-based calculated sets are dynamic by nature. Maybe somebody can tell me if I understood that wrong or what else is my problem here.
The named set are only computed once within a query. That is why your calculated member always return the same value.
You just have to remove the named set from your query:
MEMBER [Measures].[Test] AS {
StrToMember("[Time].[Date].&[" + [Project].[ParentProject].CURRENTMEMBER.PROPERTIES("Project Start Iso") + "]"):
StrToMember("[Time].[Date].&[" + [Project].[ParentProject].CURRENTMEMBER.PROPERTIES("Project End Iso") + "]")
}.COUNT