I wonder what's wrong in this code?
with
member [CA Espagne] As
((select [Measures].[CA], [[Site].[Pays - Site].[Pays].&[ES]))
select {[Measures].[CA], [CA Espagne]} on 0,
[Temps].[Année - Mois - Jour].[Année].&[20100101].children on 1
from [DistrisysOLAP_Global];
Better to tell us the error you're getting... but I guess you should simply define your calculated member as :
with member [CA Espagne] As ( [Measures].[CA], [[Site].[Pays - Site].[Pays].&[ES] )
then the remaining of the statement looks ok (remove the trailing ; ). Otherwise, here is a page explaining the syntax of the calculated members.
Related
This request always displays '1' in the column 'nb', but I know that for this patient, the number is '3':
WITH
member pat1 AS [DimTransfusion].[TransfusionPatients].[PatientId].&[{09B7106A-xxxx-4B88-80D6-D1283FE990D6}]--83
set transfusPat AS Descendants(pats1,2)
MEMBER nb AS count(transfusPat)
SELECT {nb} ON 0
FROM [BDD PBM]
but this request displays the correct result:
WITH
member pat1 AS [DimTransfusion].[TransfusionPatients].[PatientId].&[{09B7106A-xxxx-4B88-80D6-D1283FE990D6}]--83
set transfusPat AS Descendants([DimTransfusion].[TransfusionPatients].[PatientId].&[{09B7106A-FB68-4B88-80D6-D1283FE990D6}],2)
MEMBER nb AS count(transfusPat)
SELECT {nb} ON 0
FROM [BDD PBM]
I can't understand why using a member variable instead a real value gives a wrong result.
Here is the dimension usage screenshot:
where VPARCOURS and VTRANSFUSION are fact tables(a Transfusion is always related to one VPARCOURS):
thank you.
The problem was due to pat1: being a member, I suppose the Descendants function returns a member of its first argument is a member, and the same for sets:
so the correct declaration is:
set pat1 AS [DimTransfu...
I am trying to calculate the average price of an order. I have the following simple expression:
=( Max(Fields!Price, "Totals") - Max(Fields!Discount_Value.Value, "Totals") + Max(Fields!Tax_Value.Value, "Totals") + Max(Fields!Freight_Charges.Value, "Totals") - Max(Fields!Total_Freight_Cost.Value, "ShipCodesShipped") / Max(Fields!Total_Orders_Count.Value, "Totals"))
It does not seem to work at all and just shows up as #Error. Does anyone know what I'm doing wrong?
The first part of your expression
=( Max(Fields!Price, "Totals") ...
should be
=(Max(Fields!Price.Value, "Totals") ...
I have a parameter value 'SF - LYON' while trying to pass in where condition:
MEMBER [Measures].[ParameterCaption] AS [Organization].[Organization].CURRENTMEMBER.MEMBER_CAPTION
MEMBER [Measures].[Parametervalue] AS [Organization].[Organization].CurrentMember.UNIQUENAME
MEMBER [Measures].[ParameterLevel] AS [Organization].[Organization].CurrentMember.LEVEL.ORDINAL
SELECT non empty {[Measures].[ParameterCaption]
, [Measures].[ParameterValue]
, [Measures].[ParameterLevel] } ON COLUMNS
FROM [IRIS]
WHERE STRTomember('SF - LYON', CONSTRAINED) //#parameter=SF - LYON`
But I am getting this error:
Query (10, 1) The restrictions imposed by the CONSTRAINED flag in the STRTOMEMBER function were violated.
When I try it like this:
WHERE STRTomember('[SF - LYON]', CONSTRAINED) //#parameter=SF - LYON
it is working.
So my question is: How do I pass the square brackets [] through a parameter to get the desired result?
You can build up the parameter string with square brackets before passing it to the strToMember function
This MDX function raise error :
with member measures.x as
(
[Date].[Date].[Date].&[20160101] : [Date].[Date].[Date].currentmember.value
,
[Measures].[current balance]
)
select measures.x on columns,
[Branch].[HeadOffice Branch].[Head Office Code] on rows
from MyCube
Error is :
The CURRENTMEMBER function expects a hierarchy expression for the 1 argument. A member expression was used.
But when I use
[Date].[Date].[Date].&[20160101] : [Date].[Date].[Date].&[20160131]
It works good
why?
This is valid mdx:
[Date].[Date].[Date].&[20160101] : [Date].[Date].currentmember
Although this is not:
WITH member measures.x AS
(
[Date].[Date].[Date].&[20160101] : [Date].[Date].currentmember
,
[Measures].[current balance]
)
It is not valid because round braces (...) signify a tuple but a tuple requires exact co-ordinates so the first argument cannot be a set.
You could add an aggregation such as SUM:
WITH member measures.x AS
SUM
(
[Date].[Date].[Date].&[20160101] : [Date].[Date].currentmember
,
[Measures].[current balance]
)
This is valid mdx but if you do not have [Date].[Date] in context i.e. in the WHERE or SELECT clause then all it is returning is the All member.
Why are you using [Date].[Date].currentmember ?
CURRENTMEMBER works on an attribute hierarchy (in your case [Date].[Date]). So [Date].[Date].CURRENTMEMBER will work.
Also you will need to take out the value selector, as your expression returns a set of dates (member : member returns a set of all the members between those two members).
Im using SSAS Tabular. Trying to insert a column which gets data(OrgNumber) from an unrelated table called DimCustomer.
DAX-Syntax:
=Calculate(Values('DimCustomer'[OrgNum]),FILTER('DimCustomer','DimCustomer'[CustomerNr]='FactTransactions'[CustomerNr])))
Throws back error msg:
The syntax for 'FILTER' is incorrect.
The calculated column 'FactTransactions[CalculatedColumn1]' contains a syntax error. Provide a valid formula.
Try this:
=LOOKUPVALUE('DimCustomer'[OrgNum], 'DimCustomer'[CustomerNr], 'FactTransactions'[CustomerNr])
This assumes it is a calculated column on FactTransactions
I laid out your code like the below and it seems you have an extra bracket:
=Calculate
(
Values('DimCustomer'[OrgNum]),
FILTER
(
'DimCustomer',
'DimCustomer'[CustomerNr]='FactTransactions'[CustomerNr]
)
)
)