Category Archives: MDX

Include post related to MDX (MultiDimensional Expressions)

Tips and Tricks on SSRS

SSRS provide a lots of properties to update the report according to any vague requirement given by Clients. Multiple properties and all changeable is the best feature of SSRS and gives it edge over all new reporting tools.

Over the time developers can learn many ways of manipulating reports. Few cool tricks are listed in this post and can help in exploring more ways of making desired changes in SSRS reports.

1. How to get Total page number in ribbon above report?

SSRS doesn’t calculate total page number and shows on top ribbon like 1 of 2 ? for page numebrs. Instead of “?”  it should be final number of page like 11. “2” represents next page as SSRS do not calculate total number of pages.

We will need to ask SSRS to calculate Total Page Number explicitly. To do so;

Pick the “Built in FieldTotal Pages (shown as =Globals!TotalPages) and drag it on header or anywhere in report (hide it if not needed by visibility property).

As shown below:


Reports rendering will be like:

Before After
 2  3


2. Get the data refresh time of Cube (last processing time)

I have seen most of the legendary system uses extra SSAS cube to store value of last processing time of main SSAS Cube.

Use following query to get refresh time of any cube and keep it as a new dataset in report.

SELECT TOP 1 LAST_DATA_UPDATE FROM $system.mdschema_cubes
WHERE CUBE_CAPTION = 'Adventure_Works'

Save as dataset “dsLastUpdatetime”. And in report create a Text Box and keep expression as:

="Data Refresh Time:  " & First(Fields!LAST_DATA_UPDATE.Value, "dsLastUpdatetime") & " UTC"


3. Based on rendering/export format, change properties.

SSRS provides multiple rendering format or Export format. With a property Globals!RenderFormat.Name we can make sure how final output in desired format (excel/pdf/csv etc.) should appear.

For example in my report I show Selected parameter values on top on SSRS view. But if user download the file he/she wants only report data. So I change visibility of text Box (of parameter values) as following:

=IIF(Globals!RenderFormat.Name = "EXCEL", FALSE, TRUE)

And SSRS and Excel have different appearance as final report.


4. If you are not using Tooltip, you are not using SSRS properly

Option for Tooltip is everywhere. If you are not using it you are missing out a big feature. Users of SSRS mostly expect interactive reports though SSRS but its not as fun as other tools. At least tool tips add a one more attribute of reporting objects (like bar values in charts, description of column header etc.). Use it under Chart properties, Series properties, Text Box properties etc. to add more details in report.


5. Use SWITCH function for expressions instead of nested IIF.

Its easy and fast. Don’t forget to use TRUE as a default value. Example given below:

=SWITCH(Fields!RegionShort.Value = "N", "North",
Fields!RegionShort.Value = "S", "South",
Fields!RegionShort.Value = "E", "East",
Fields!RegionShort.Value = "W", "West",
TRUE, "Unknown")


6. Do not need datasets for Parameters all the time (even in MDX reports)

Mostly we rely on datasets values for Available values in property of Parameters. Its not mandatory. Imagine All and Female are two values of Parameter. In MDX dataset lot of stuff will be needed to avoid Male values.

Someone will create a dataset with except for Male option for same case. Or provide a filter on parameter to avoid Male option (with All member including). Simply, provide static values, just like below:



7. Create simple dynamic members on Parameters instead of dataset.

On extension to above, we can create dynamic members as per requirement just using same method.

For example, an Adventure Works report is needed where Parameter Product Category should have 3 values ALL, Actual_Products(comprising Bikes and Components) and By_Products(comprising Accessories and Clothing). Not values from cube.

So either you can use following MDX as dataset to fill the values:

MEMBER [Product].[Category].[Actual_Products] AS
MEMBER [Product].[Category].[By_Products] AS
{[Product].[Category].[Actual_Products], [Product].[Category].[By_Products],
[Product].[Category].[(All)]} on 1
FROM [Adventure Works]

Or simply just get the parameter Available values as following:

ALL =”[Product].[Category].[(All)]”
Actual Products =”{[Product].[Category].[Bikes],[Product].[Category].[Components]}”
By Products =”{[Product].[Category].[Accessories],[Product].[Category].[Clothing]}”

Cube Optimization Journal: Introduction

I have been working on cube optimization techniques for some time now. And honestly I even got my job for the same requirement. Its actually interesting to work with team of highly qualified MSBI professionals and learn new things on the same field, you were very confident about.

I am starting this as a journal and hoping to cover more and more on the topic gradually. In this way we can achieve a more strong foundation on this topic.

In this post we will cover the aspects where Cube optimization can be applicable/tested actually.

Following are areas we think of when we talk about cube optimization:

  1. Decreased usual size of cube: we often come in situation where cube is created and being used but it takes a lot of space on server. Cube optimization is mostly focused on decreasing the cube size which can lead to more efficiency in different other areas as well (listed below).
  2. Decreased processing time of cube: this one is a catch and we always want to achieve. Decrease in processing time can also impact in limiting space of cube, good reporting time, more frequency of data processing. Mostly due to longer time period of processing we decrease frequency of processing and users see a great latency in the report data (talking about MOLAP).
  3. Fast Reporting: Optimizing MDXs only in SSRS reports cannot give you fast report, it must come from real source “the cube”. And reporting like excel are only as fast as a cube is. We need faster reports for that we need a faster cube.
  4. “Can you think of any more valid reason anymore?”

Well we can talk about many other less important aspects like Loads on servers, better architecture blah blah . . .but what I believe is in project whats most important aspect is “Client” nothing else is significant more.

Client doesn’t care about populous server till he gets the result and damn if he care about your architecture if he doesn’t get the result he expected. Harsh but true :P.

So I hope using most important aspects for cube optimization. I will start with one of them to cover simple and effective optimization techniques.