• subscribe
August 01, 1999 12:00 AM

MDX Tip of the Month

SQL Server Pro
InstantDoc ID #5755

Do you know how to write an MDX query that returns non-numeric results? Here is an example of how useful this capability can be. If you list your company's top 10 products based on unit sales, wouldn't you like to see a mark next to the products that make a low profit? The following MDX query demonstrates how you can create a calculated member that results in string values rather than numeric measure values.

WITH MEMBER [Measures].[Low Profit] as 'iif( 
   ([Product].CurrentMember, 
   [Profit]) < 300, "!!!", "")'
SELECT { [Unit Sales], [Low
   Profit] } ON COLUMNS,
 TOPCOUNT( [Product].[Product
   Name].Members, 10, [Unit
   Sales] ) ON ROWS
FROM [Sales] 

The query compares the current product's profit against 300. If profit for a product is less than 300, you see "!!!". Otherwise, you see an empty string. The result is in Screen A.



ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...
  • Dell Compellent Disk Drive
    Does anybody has experience with Dell Compellent Disk Drive? Basically, this system manages all disk...
  • Sql server performance tuning
    I need to find a tool that help me to optimize sql server,queries,improve the performance and solve ...