Advanced MDX Ranking

There was a situation that I want to get the Rank value considering three dimension levels. In one of earlier post (MDX Rank post), I mentioned how to get the rank value for two dimension levels.
This post will shows the MDX query to get the rank value for three dimension levels.

Lets consider a scenario that we want to get the Rank value of a department considering the stores of a particular region. Below MDX query will give the required rank value.

WITH
MEMBER [Measures].[RankSales] AS
RANK(([Store—Region_Store].CurrentMember,[Store—Region].CurrentMember,[Item—Department].CurrentMember),
ORDER(({[Store—Region_Store].[Store].MEMBERS*[Store—Region].CurrentMember*[Item—
Department
].CurrentMember}),
[Measures].[Sales],
BDESC))

SELECT
{[Measures].[RankSales]} ON 0,
{[Store—Store].[Store].MEMBERS*[Item—
Department
].[
Department
].MEMBERS
} ON 1
FROM
[Sales]
where {[Store—Region].[All Store—Region].[Region1]}*{[Item—
Department_Sub
].[All Item—
Department_Sub
].[
Department1
]}

Likewise we can expand the query to any dimension levels. Hopes this will help you...

Non-Windows user credentials were supplied for a non-http connection to Analysis Services...

While trying to view a SSRS report in the report server outside from the server, I got the below error message.

Non-Windows user credentials were supplied for a non-http connection to Analysis Services. The Microsoft SQL Server Analysis Services data extension requires Windows Integrated Security unless connecting via http or https.

This because when we access the data source which use for the report from outside, it cannot connect to the cube due to the user permission issue.

  • When we want to provide access for non domain users to the report, we provide credentials of an authorized user for the data source. 
  • Go to the Data Source folder in the report server and then click on the relevant data source. 
  • Then you will get set of properties and in that you can see Connect using: property. 
  • In that select Credentials stored securely in the report server option and provide a valid user name and password. 
  • But if you click Apply button by just providing that user name and password, when you are going to view the report you will get the above error message. 
  • To solve it you just want put a tick on Use as Windows credentials when connecting to the data source just below the Password. 
  • Then test the connection and click Apply after that.


Then view the report and you will be able to view it...

Case Sensitivity with SSRS Grouping ?

When I created a SSRS report to retrieve SSAS cube data, I found that the dimension members which contains same name but has different case, has been missing. As an example if you have two dimension members of Item dimension as item1 and Item1, then only one will be shown.
The reason was that it does not support case sensitivity with grouping.

To have the case sensitivity in the report I had to do two changes. One is in the cube level and the other one is in the report data set level.

At the dimension level you have to allow case sensitive. To do that open the dimension in the dimension editor using BIDS, the select the dimension and view the properties. At the top of the Properties window you will find the Collation property. Click on the button and put a tick in front of Case Sensitive value. Then process the dimension and then process the cube.

Even though you change this, you will not get the expected result in the report. To get it, select the Dataset in the Report Data tab and double click on it. Then go to the Options section and then select True from Case sensitivity: drop down list. Click Ok and preview the report. Then you should get the both item1 and Item1 records.

MDX Rank

Normally we use MDX Rank function to get the rank value considering just one dimension level. But I face an situation that Rank value needed to be taken considering two dimension levels. As an example needed to get the Rank of Sales value of stores, which related to a Region.
I was unable to find a direct solution and after doing some researches I was able to build the MDX query.
The query is given below.

WITH
MEMBER [Measures].[Rank] AS
RANK(([Store—Region].CurrentMember,[Store—Region_Store].CurrentMember),
ORDER(({[Store—Region_Store].[Store].MEMBERS*[Store—Region].CurrentMember}),
[Measures].[Sales],
BDESC))
SELECT
{[Measures].[Rank], [Measures].[Sales]} ON 0,
{[Store—Region_Store].[Store].MEMBERS} ON 1
FROM
[Sales]
where {[Store—Region].[All Store—Region].[Region1]}

If we give the region value as Region1, then what this query does is it rank only the stores which are related to the Region1 region. If the Region1 region contains 5 stores, the highest rank value you will get is 5.
Hope this will help for you as well...

How to run UPDATE/INSERT/DELETE Statements on Azure SQL Database in Microsoft Fabric Notebook...

You can run UPDATE/INSERT/DELETE Statements on Azure SQL Database in Microsoft Fabric Notebook using Python SQL Driver - pyodbc.  For the Fa...