Statistics


title: "Reworded Title" description: "A different description."

Let's explore the concept of measures within MDX.

-- Sample MDX Query
SELECT
  {[Measures].[Internet Sales Amount]} ON COLUMNS,
  {[Date].[Calendar Year].&[2008]} ON ROWS
FROM
  [Adventure Works]

The MDX query shown above retrieves the 'Internet Sales Amount' for the year 2008.

MDX, or Multidimensional Expressions, is a query language used for OLAP (Online Analytical Processing) databases. More information can be found here.

Calculated members can also be defined in MDX.

WITH
  MEMBER [Measures].[Profit Margin] AS
    ([Measures].[Internet Sales Amount] - [Measures].[Internet Total Product Cost]) / [Measures].[Internet Sales Amount]
SELECT
  {[Measures].[Profit Margin]} ON COLUMNS,
  {[Date].[Calendar Year].&[2008]} ON ROWS
FROM
  [Adventure Works]

The preceding MDX snippet defines a calculated member called 'Profit Margin'.

This calculated member is calculated as (Internet Sales Amount - Internet Total Product Cost) / Internet Sales Amount.


```mdx
---
title: "Title Changed"
description: "A revised description."
---

We will now consider the idea of measures in MDX.

```mdx
-- Sample MDX Query
SELECT
  {[Measures].[Internet Sales Amount]} ON 0,
  {[Date].[Calendar Year].&[2008]} ON 1
FROM
  [Adventure Works]

The MDX query presented here obtains the 'Internet Sales Amount' specifically for the year 2008.

MDX, which stands for Multidimensional Expressions, represents a query language employed with OLAP (Online Analytical Processing) databases. You can find further details here.

It's also possible to declare calculated members inside MDX.

WITH
  MEMBER [Measures].[Profit Margin] AS
    ([Measures].[Internet Sales Amount] - [Measures].[Internet Total Product Cost]) / [Measures].[Internet Sales Amount]
SELECT
  {[Measures].[Profit Margin]} ON 0,
  {[Date].[Calendar Year].&[2008]} ON 1
FROM
  [Adventure Works]

The MDX example provided above creates a calculated member named 'Profit Margin'.

This calculated member's value is determined by the formula: (Internet Sales Amount - Internet Total Product Cost) / Internet Sales Amount.

Appearances

This article uses content from Wookiepedia, under CC-BY-SA 3.0.