MDX SORTING not Working - mdx

I want to sort one column in the desending format.The MDX query need to sort out is shown below.In der I am using the "[Measures].[Count]" field in the where clause.And i want to sort the measures in descending format..I already used the "ORDER" Function in the qry.bt i am getting errors..
/*
SELECT
NON EMPTY { [Operator].[Total],[Operator].[Total] .Children } ON COLUMNS,
NON EMPTY { [Circle].[Total], [Circle].[Total] .Children } ON ROWS FROM
[GENERATOR]
WHERE
( [Measures].[Count], [RoamingFlag].[INRoaming], [Date].[${yesterday}] , [SuccessFailureDetails].[FAILURE] )
*/
Can anyone help me to solve the problem..
Thanks...

SELECT
NON EMPTY {[Operator].[Total],[Operator].[Total].Children} ON COLUMNS,
NON EMPTY ORDER({[Circle].[Total],[Circle].[Total].Children},[Measures].[Count],BASC) ON ROWS FROM [GENERATOR]
WHERE
([Measures].[Count], [RoamingFlag].[INRoaming], [Date].[${yesterday}],[SuccessFailureDetails].[FAILURE])
Hopefully!

Related

SimeReplacing WeekOfYear Dynamically

I am using copy activity in ADF in which i have following pseudo query:
SELECT
{
[Measures].[**************],
[Measures].[**************],
[Measures].[**************]
} ON COLUMNS,
NON EMPTY
{
[0CALWEEK].[LEVEL01].MEMBERS
}
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM cubeName/ReportName
SAP VARIABLES [SAP_VARIABLE_NAME]
INCLUDING [0CALWEEK].[201905]
In the above i want to replace '201905' dynamically,there is no current function availabe to get WeekOfYear in ADF Expressions and functions OR can i use MDX Query to generate WeekOfYear
Take a look at this example how it changes value for a member value. Please note I have answerd if from phone so some syntax issue might exist.
With member measures.t
As
Case when
[0CALWEEK].[LEVEL01]. currentmember.name="'201905"
Then 1
Else
0
End
SELECT
{
[Measures].[t]
} ON COLUMNS,
NON EMPTY
{
[0CALWEEK].[LEVEL01].MEMBERS
} ON ROWS
FROM cubeName/ReportName

MDX Query Tuple representation using ampersand

What is the difference between representing tuple in an mdx query as
[CF Type].[CF TYPE].&[6]
OR
[ValScen].[Scenario Type].&[Term Point Rates]
Can I use the &[number] and the &[actual string] format interchangeably? If the cube is generated by another system, can the &[6] be different for each generation in usual practice? Or is it safer to use StrToMember or StrToSet. But this is not efficient as per this article. To give some context, in my case I use it like in below pseudocode
SELECT NON EMPTY { [Measures].x} ON COLUMNS, NON EMPTY { (My Column1 * My Column2)} DIMENSION PROPERTIES MEMBER_CAPTION ON ROWS FROM ( SELECT ( { [CF Type].[CF TYPE].&[6] } ) ON COLUMNS FROM
( SELECT ( { [ValScen].[Scenario Type].&[Term Point Rates] } ) ON COLUMNS FROM [My Cube]]))
WHERE ( [ValScen].[Scenario Type].&[Term Point Rates], [CF Type].[CF TYPE].&[6] )
Those are members and not tuples. A Tuple would be surrounded by braces ().
I think they are interchangeable syntax if you’re using the caption such as .&[hello] and .[hello] but if you use the key then the ampersand is mandatory.

Issue in displaying Decimal fields in SSRS with mdx Query

We are facing issue while displying the amount in ssrs reports which makes use of mdx query.
For Example : this value is retured by mdx query 278.25 but when it is binded with ssrs it shows 27.825,00.
We are using culture de-DE(German) in report.
We have tried the following solutions but still the issue remains in SSRS report:
From mdx side We have tried FORMAT_STRING = "#0,00" function for displying numeric value.
From report side we have tried to use replace function to replace '.' with ',', but its not working fine.
Sample Query can be found below
WITH
MEMBER [Measures].[CumEGTKDAmount] AS sum({[Time].[Month].FIRSTCHILD: [Time].[Month].CurrentMember},[Measures].[EGTKD] * [Measures].[AvgStockPrice])
SELECT
{
[Measures].[CumEGTKDAmount]
} ON COLUMNS,
NON EMPTY {
topcount(
(
STRTOSET("[Dim Item].[ItemHierarchy].[Item No].&[00001133]")
)
,50,[Measures].[ReklaQuote])
} ON ROWS
FROM [QM]
Thanks
Try this:
=Replace(Format(Fields!YourFieldName.Value, "#,###0.00"),",",".")

MDX " BETWEEN .. AND" CONDITION

I am using one MDX Equation as shown below.
SELECT
NON EMPTY { [Operator].[Total],[Operator].[Total] .Children } ON COLUMNS,
NON EMPTY { [Circle].[Total], [Circle].[Total] .Children } ON ROWS FROM
[16CircleWiseRoamingFailure5]
WHERE
( [Measures].[Count], [RoamingFlag].[INRoaming], [Date].[${yesterday}] , [SuccessFailureDetails].[FAILURE] )
here i am passing one function called "yesterday" which gives only yesterdays data.
Now i want to find values within an interval e.g. between month or between days. Can anyone tell me the syntax...?
In Analysis Services, you can use a range, using the ":" operator.
http://msdn.microsoft.com/en-us/library/ms146001.aspx
Don't know if it works in Pentaho

Filter by one MDX dimension but display another

I'm trying to write an MDX query that limits the results returned by one dimension of my cube but displays the aggregate from another, does anyone know if this is possible?
What I effectively want to execute is:
SELECT
NON EMPTY
Filter([Index].[Index].Members, [Imnt Ctry].[ImntCtry].CurrentMember.Name<>"GB")
ON ROWS,
NON EMPTY {[Measures].[T.SUM], [Measures].[B.SUM], [Measures].[L.SUM], [Measures].[SBL.SUM], [Measures].[P.SUM], [Measures].[R.SUM], [Measures].[Coll.SUM], [Measures].[Long.SUM], [Measures].[Short.SUM], [Measures].[Firm.SUM], [Measures].[Net.SUM], [Measures].[PTH.SUM]} ON COLUMNS
FROM [PositionsCube]
This executes but returns nothing, I can alternatively execute:
SELECT
NON EMPTY
Crossjoin([Index].[Index].Members, Filter([Imnt Ctry].[ImntCtry].Members, [Imnt Ctry].[ImntCtry].CurrentMember.Name<>"GB"))
ON ROWS,
NON EMPTY {[Measures].[T.SUM], [Measures].[B.SUM], [Measures].[L.SUM], [Measures].[SBL.SUM], [Measures].[P.SUM], [Measures].[R.SUM], [Measures].[Coll.SUM], [Measures].[Long.SUM], [Measures].[Short.SUM], [Measures].[Firm.SUM], [Measures].[Net.SUM], [Measures].[PTH.SUM]} ON COLUMNS
FROM [PositionsCube]
which gives me the correct result set, but is now aggregating by Index > Imnt Ctry where I just want Index.
Additionally I have tried declaring a set and using an Intersection, but the intersection has to declare the same dimensions as the set else doesn't parse so is no more use.
It seems this would be a logical operation to want to perform, but I just can't get it.
Use the Slice Section.
WITH
Set [FilterImnt] As (Filter([Imnt Ctry].[ImntCtry].Members, [Imnt Ctry].[ImntCtry].CurrentMember.Name<>"GB"))
SELECT
NON EMPTY
{[Index].[Index].Members}
ON ROWS,
NON EMPTY {[Measures].[T.SUM], [Measures].[B.SUM], [Measures].[L.SUM], [Measures].[SBL.SUM], [Measures].[P.SUM], [Measures].[R.SUM], [Measures].[Coll.SUM], [Measures].[Long.SUM], [Measures].[Short.SUM], [Measures].[Firm.SUM], [Measures].[Net.SUM], [Measures].[PTH.SUM]} ON COLUMNS
FROM [PositionsCube]
Where ({[FilterImnt]})