dcsimg

MDX Essentials: Basic Set Functions: Subset Functions: The Head() Function - Page 4

May 10, 2004

Handling of Numeric Value

Next, let's explore the handling of omitted numeric values, among the other "default" treatments that the Head() function doles out. We can see these treatments in action by simulating some quick scenarios.

1. Within the query we have saved as MDX19-1, replace the top comment line of the query with the following:

-- MDX019-2, Use of Head() Function - Omitted Numeric Expression

2. Save the query as MDX19-2, to prevent damaging MDX19-1.

3. Remove the comma (",") and numeral 3 from the following line of the query:

              {Head([Time].[1998].Children, 3)} ON COLUMNS,

The Query pane appears as shown in Illustration 2.

Click for larger image

Illustration 2: The Query with Omitted Numerical Expression

4. Execute the query by clicking the Run Query button in the toolbar.

The Results pane is populated, and the dataset shown in Illustration 3 appears.


Illustration 3: Result Dataset - Head() Function with Omitted Numerical Expression

5. Re-save the file as MDX19-2.

6. Leave the query open for the next step.

We see that the "default" value assumed by the function, in the absence of a specified numeric expression, is 1. Q1 only is returned, on the column axis, as a result.

7. Within the query we have saved as MDX19-2, replace the top comment line of the query with the following:

-- MDX019-3, Use of Head() Function -Numeric Expression < 1

8. Save the query as MDX19-3.

9. Add a comma (",") after .Children, then a space, and then the numeral -1, into the following line of the query:

              {Head([Time].[1998].Children)} ON COLUMNS,

The Query pane appears as shown in Illustration 4, with the inserted coding circled in red.


Illustration 4: The Query with Numerical Expression Less Than 1








The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers