<?xml version="1.0" encoding="utf-8"?>
<!--
 fmmdx.xml - a report comprised of lots of MDX queries against FoodMart
 This set was both a test of the different chart and table slide
 types and also a sampling of MDX expression syntax.
-->
<slideset>
	<template>repository/ppt/landscape_blue_c.ppt</template>
	<!-- ==================================================================== -->
	<slide type="coverpage">
		<title>FoodMart 2000 OLAP Queries</title>
		<subtitle>long version</subtitle>
	</slide>
	<!-- ==================================================================== -->
	<slide type="bar" PlotBy="Column">
		<title>Unit Sales by Promotion Media Type</title>
		<notes>S1 Made axis scale thousands and made axis number
		currency. I don't know if these are worth automating.</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Unit Sales] 
		AS 'Measures.[Unit Sales]', FORMAT_STRING = '#,#'
SELECT 
	{
	[Measures].[$Unit Sales]
	}
	ON COLUMNS, 
	ORDER(
		EXCEPT(
			[Promotion Media].[Media Type].MEMBERS,
			{[Promotion Media].[Media Type].[No Media]}
		),
		[Measures].[$Unit Sales],
		DESC
	)
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="textbox">
		<title>Units Shipped and Ordered by Store</title>
		<notes>S2 heading row should be different - bold, orange?</notes>
		<query type="mdx">
SELECT
	{
	[Measures].[Units Shipped],
	[Measures].[Units Ordered]
	}
	ON COLUMNS,
	NON EMPTY
		[Store].[Store Name].MEMBERS
	ON ROWS
FROM [Warehouse]
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="bar" PlotBy="Column">
		<title>Store Sales (last period) by Department</title>
		<notes>S3</notes>
		<query type="mdx">
WITH
	MEMBER [Measures].[Store Sales Last Period] 
	AS '([Measures].[Store Sales], Time.PrevMember)', FORMAT_STRING = '$###,###'
SELECT 
	{
		[Measures].[Store Sales Last Period]
	}
	ON COLUMNS,
	{
		TOPCOUNT(
			[Product].[Product Department].MEMBERS,
			5,
			[Measures].[Store Sales Last Period]
		)
	}
	ON ROWS
FROM Sales
WHERE ([Time].[1998])
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="table">
		<title>Accumulated Sales</title>
		<subtitle>by Product Department</subtitle>
		<notes>S4</notes>
		<query type="mdx">
WITH 
	MEMBER [Measures].[Total Store Sales]
	AS 'Sum(YTD(),[Measures].[Store Sales])'
SELECT
	{
		[Measures].[Total Store Sales]
	}
	ON COLUMNS,
	{
		TOPCOUNT
			(
				[Product].[Product Department].MEMBERS,
				5,
				[Measures].[Total Store Sales]
			)
	}
	ON ROWS
FROM Sales
WHERE
	(
		[Time].[1997].[Q2].[4]
	)
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="table">
		<title>Costs and Profit Rate</title>
		<subtitle>by Product Department</subtitle>
		<notes>S5</notes>
		<query type="mdx">
WITH
	MEMBER [Measures].[Store Profit Rate]
	AS '([Measures].[Store Sales]-[Measures].[Store Cost])/[Measures].[Store Cost]', format = '#.00%'
SELECT 
	{
		[Measures].[Store Cost],
		[Measures].[Store Sales],
		[Measures].[Store Profit Rate]
	}
	ON COLUMNS,
	Order(
		[Product].[Product Department].MEMBERS,
		[Measures].[Store Profit Rate],
		BDESC
	)
	ON ROWS
FROM Sales
WHERE ([Time].[1997])
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="bar" PlotBy="Column">
		<title>Percent of Alcoholic Drinks</title>
		<notes>S6</notes>
		<query type="mdx">
WITH 
	MEMBER [Product].[All Products].[Drink].[Percent of Alcoholic Drinks]
	AS '[Product].[All Products].[Drink].[Alcoholic Beverages]/[Product].[All Products].[Drink]', format = '#%'
SELECT
	{
		[Product].[All Products].[Drink].[Percent of Alcoholic Drinks]
	}
	ON COLUMNS,
	ORDER
		(
			[Customers].[All Customers].[USA].[WA].CHILDREN,
			[Product].[All Products].[Drink].[Percent of Alcoholic Drinks],
			BDESC
		)
	ON ROWS
FROM Sales
WHERE ( [Measures].[Unit Sales] )
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="accumcolumn">
		<title>Sales and Accumulated Sales</title>
		<subtitle>by Month (1997)</subtitle>
		<notes>S7</notes>
		<query type="mdx">
WITH 
	MEMBER Measures.[$Store Sales]
		AS 'Measures.[Store Sales]', FORMAT_STRING = '$###,###'
	MEMBER [Measures].[Accumulated Sales]
		AS 'Sum(YTD(),[Measures].[Store Sales]) - [Measures].[Store Sales]', FORMAT_STRING = '$###,###'
SELECT 
	{
		[Measures].[Accumulated Sales],
		[Measures].[$Store Sales]
	}
	ON COLUMNS,
	{
		DESCENDANTS
			(
				[Time].[1997],
				[Time].[Month]
			)
	}
	ON ROWS
FROM Sales
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="accumbar">
		<title>Sales and Accumulated Sales</title>
		<subtitle>by Month (1997)</subtitle>
		<notes>S7</notes>
		<query type="mdx">
WITH 
	MEMBER Measures.[$Store Sales]
		AS 'Measures.[Store Sales]', FORMAT_STRING = '$###,###'
	MEMBER [Measures].[Accumulated Sales]
		AS 'Sum(YTD(),[Measures].[Store Sales]) - [Measures].[Store Sales]', FORMAT_STRING = '$###,###'
SELECT 
	{
		[Measures].[Accumulated Sales],
		[Measures].[$Store Sales]
	}
	ON COLUMNS,
	{
		DESCENDANTS
			(
				[Time].[1997],
				[Time].[Month]
			)
	}
	ON ROWS
FROM Sales
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="table">
		<title>Ranked top 10 first-level managers</title>
		<notes>s9</notes>
		<query type="mdx">
WITH
	SET [Leaves]
		AS 'Descendants([Employees].[All Employees], 15, LEAVES )'
	SET [Parents]
		AS 'Generate( [Leaves], {[Employees].CurrentMember.Parent} )'
	SET [FirstParents]
		AS 'Filter( [Parents], Count( Descendants( [Employees].CurrentMember, 2 )) = 0 )'
SELECT
	{
		[Measures].[Number of Employees]
	}
	ON COLUMNS,
	TOPCOUNT
		(
			[FirstParents],
			10,
			[Measures].[Number of Employees]
		)
	ON ROWS
FROM HR
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="table">
		<title>Topcount Example</title>
		<notes>s10 - fix, make measures list explicit</notes>
		<query type="mdx">
SELECT
	{
	Measures.[Unit Sales],
	Measures.[Store Cost]
	}
	ON COLUMNS,
	TOPCOUNT
		(
			{
				[Store].[Store City].MEMBERS
			},
			12,
			Measures.[Sales Count]
		)
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ====================================================================
	<slide type="table">
		<title>Bottomcount Example</title>
		<notes>s11 - fix, make measures list explicit</notes>
		<query type="mdx">
SELECT
	NON EMPTY
	{
	Measures.[Unit Sales],
	Measures.[Store Cost]
	}
	ON COLUMNS,
	BOTTOMCOUNT
		(
			{
				FILTER(
					[Store].[Store City].MEMBERS, 
					NOT ISNULL(Measures.[Sales Count])
				)
			},
			12,
			Measures.[Sales Count]
		)
	ON ROWS
FROM [Sales]
		</query>
	</slide>
 -->
	<!-- ==================================================================== -->
	<slide type="table">
		<title>Descendents example</title>
		<notes>s12 - fix, make measures list explicit</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Unit Sales] 
		AS 'Measures.[Unit Sales]', FORMAT_STRING = '#,#'
	MEMBER Measures.[$Store Cost] 
		AS 'Measures.[Store Cost]', FORMAT_STRING = '$###,###'
	MEMBER Measures.[$Store Sales Net] 
		AS 'Measures.[Store Sales Net]', FORMAT_STRING = '$###,###'
SELECT
	{
		Measures.[$Unit Sales],
		Measures.[$Store Cost],
		Measures.[$Store Sales Net]
	}
	ON COLUMNS,
	{
		[Store].[Store State].[CA],
		DESCENDANTS
			(
				[Store].[Store State].[CA],
				[Store City],
				SELF
			)
	}
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ====================================================================
	<slide type="table">
		<title>Store's sales percentage profit</title>
		<subtitle>for each quarter and half year</subtitle>
		<notes>s13</notes>
		<query type="mdx">
WITH
	MEMBER Measures.ProfitPercent
		AS '(Measures.[Store Sales] - Measures.[Store Cost]) /(Measures.[Store Cost])', FORMAT_STRING = '#%', SOLVE_ORDER = 1
	MEMBER [Time].[First Half 97] 
		AS '[Time].[1997].[Q1] + [Time].[1997].[Q2]'
	MEMBER [Time].[Second Half 97] 
		AS '[Time].[1997].[Q3] + [Time].[1997].[Q4]'
SELECT 
	NON EMPTY
	{
		[Time].[First Half 97],
		[Time].[Second Half 97],
		[Time].[1997].CHILDREN
	}
	ON COLUMNS, 
	NON EMPTY
   {
		[Store].[Store Name].MEMBERS
	}
	ON ROWS
FROM [Sales]
WHERE
	(
		Measures.ProfitPercent
	)
		</query>
	</slide>
 -->
	<!-- ==================================================================== -->
	<slide type="table">
		<title>Store Profit</title>
		<subtitle>for the first quarter of each year</subtitle>
		<notes>s14</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Profit] 
		AS 'Measures.[Profit]', FORMAT_STRING = '$###,###'
	SET [Quarter1]
		AS 'GENERATE([Time].[Year].MEMBERS, {[Time].CURRENTMEMBER.FIRSTCHILD})'
SELECT
		[Quarter1]
	ON COLUMNS,
	NON EMPTY
		[Store].[Store Name].MEMBERS
	ON ROWS
FROM [Sales]
WHERE
	(
		Measures.[$Profit]
	)
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="table">
		<title>Sales of a Product Brand</title>
		<subtitle>as a percentage of the sales of that product within its subcategory</subtitle>
		<notes>s15</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Unit Sales] 
		AS 'Measures.[Unit Sales]', FORMAT_STRING = '#,#'
	MEMBER MEASURES.[Percentage Sales]
		AS '([Product].CURRENTMEMBER, Measures.[Unit Sales]) / ([Product].CURRENTMEMBER.PARENT, Measures.[Unit Sales])', FORMAT_STRING = '#.00%'
SELECT
	{
		MEASURES.[$Unit Sales],
		MEASURES.[Percentage Sales]
	}
	ON COLUMNS,
	HEAD([Product].[Brand Name].MEMBERS,20)
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ====================================================================
	<slide type="table">
		<title>Product Sales by Brand Name</title>
		<subtitle>as a percentage of the sales within the department</subtitle>
		<notes>s16</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Unit Sales] 
		AS 'Measures.[Unit Sales]', FORMAT_STRING = '#,#'
	MEMBER Measures.[Percentage Sales]
		AS '([Product].CURRENTMEMBER, Measures.[Unit Sales]) /
			(ANCESTOR([Product].CURRENTMEMBER, [Product Category]),Measures.[Unit Sales])'
SELECT
	{
		Measures.[$Unit Sales],
		Measures.[Percentage Sales]
	}
	ON COLUMNS,
	HEAD([Product].[Brand Name].MEMBERS,20)
	ON ROWS
FROM [Sales]
		</query>
	</slide>
 -->
	<!-- ==================================================================== -->
	<slide type="table">
		<title>Percentage of sales for top 10 promotion</title>
		<subtitle>compared only to other promotions</subtitle>
		<notes>s17</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Unit Sales] 
		AS 'Measures.[Unit Sales]', FORMAT_STRING = '#,#'
	SET [PromotionSales]
		AS 'EXCEPT({[Promotions].[All Promotions].CHILDREN}, {[Promotions].[No Promotion]})'
	MEMBER Measures.[Percentage Sales]
		AS '([Promotions].CURRENTMEMBER, Measures.[Unit Sales]) / SUM([PromotionSales], Measures.[Unit Sales])', FORMAT_STRING = '#.00%'
SELECT
	{
		Measures.[$Unit Sales],
		Measures.[Percentage Sales]
	}
	ON COLUMNS,
	TOPCOUNT(
		[PromotionSales],
		10,
		Measures.[Percentage Sales]
	)
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ====================================================================
	<slide type="table">
		<title>Unit sales for promotions</title>
		<subtitle>for each year with quarter details</subtitle>
		<notes>s18</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Unit Sales] AS 'Measures.[Unit Sales]', FORMAT_STRING = '#,#'
SELECT
	{
		GENERATE
			(
				[Time].[Year].MEMBERS,
				{
					[Time].CURRENTMEMBER,
					[Time].CURRENTMEMBER.CHILDREN
				}
			)
	}
	ON COLUMNS,
	HEAD([Promotions].[All Promotions].CHILDREN,10)
	ON ROWS
FROM [Sales]
WHERE 
	(
		Measures.[$Unit Sales]
	)
		</query>
	</slide>
 -->
	<!-- ==================================================================== -->
	<slide type="packedcolumn" PlotBy="Column">
		<title>Sales Growth Over Time</title>
		<notes>s19</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Profit] 
		AS 'Measures.[Profit]', FORMAT_STRING = '$###,###'
	MEMBER Measures.[Profit Growth]
		AS '(Measures.[Profit])  - (Measures.[Profit], [Time].PREVMEMBER)', FORMAT_STRING = '$###,###'
SELECT
	{
		Measures.[$Profit],
		Measures.[Profit Growth]
	}
	ON COLUMNS,
	{
		DESCENDANTS(
			[Time].[1997],
			[Month]
		)
	}
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ====================================================================
	<slide type="packedcolumn" PlotBy="Column">
		<title>Profit Growth</title>
		<subtitle>compared with that of the previous month</subtitle>
		<notes>s20</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Profit] 
		AS 'Measures.[Profit]', FORMAT_STRING = '$###,###'
	MEMBER Measures.[Profit Growth]
		AS '(Measures.[Profit]) - (Measures.[Profit], PARALLELPERIOD([Time].[Quarter]))',  FORMAT_STRING = '$###,###'
SELECT
	{
		Measures.[$Profit],
		Measures.[Profit Growth]
	}
	ON COLUMNS,
	{
		DESCENDANTS(
			[Time].[1997],
			[Month]
		)
	}
	ON ROWS
FROM [Sales]
		</query>
	</slide>
 -->
	<!-- ====================================================================
	<slide type="table">
		<title>Unit Sales Difference</title>
		<subtitle>for each month compared with the opening month of quarter</subtitle>
		<notes>s21</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Unit Sales] 
		AS 'Measures.[Unit Sales]', FORMAT_STRING = '#,#'
	MEMBER Measures.[Sales Difference]
		AS '(Measures.[Unit Sales]) - (Measures.[Unit Sales], OPENINGPERIOD([Time].[Month], [Time].CURRENTMEMBER.PARENT))', FORMAT_STRING = '###,###'
SELECT
	{
		Measures.[$Unit Sales],
		Measures.[Sales Difference]
	}
	ON COLUMNS,
	{
		DESCENDANTS(
			[Time].[1997],
			[Month]
		)
	}
	ON ROWS
FROM [Sales]
		</query>
	</slide>
 -->
	<!-- ==================================================================== -->
	<slide type="packedcolumn">
		<title>Monthly Year-to-Date Sales</title>
		<subtitle>for each product category in 1997</subtitle>
		<notes>s22</notes>
		<query type="mdx">
WITH
	MEMBER Measures.YTDSales
		AS 'SUM(YTD(), Measures.[Store Sales])', FORMAT_STRING = '$#,#.00' 
SELECT
	{
		DESCENDANTS
			(
				[Time].[1997],
				[Month]
			)
	}
	ON COLUMNS,
	{
		HEAD([Product].[Product Category].MEMBERS,10)
	}
	ON ROWS
FROM [Sales]
WHERE
	(
		Measures.YTDSales
	)
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="table">
		<title>Store Sales Profit</title>
		<subtitle>for those whose unit sales exceed 25,000 in 1997 for each city \rbased against the store type</subtitle>
		<notes>s23</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Profit] 
		AS 'Measures.[Profit]', FORMAT_STRING = '$###,###'
SELECT
	NON EMPTY
	{
		[Store Type].[Store Type].MEMBERS
	}
	ON COLUMNS,
FILTER
	(
		{
			[Store].[Store City].MEMBERS
		},
		(
			Measures.[Unit Sales],
			[Time].[1997]
		) &gt; 25000
	)
	ON ROWS
FROM [Sales]
WHERE
	(
		Measures.[$Profit],
		[Time].[Year].[1997]
	)

		</query>
	</slide>
	<!-- ====================================================================
	<slide type="table">
		<title>Percent Profit by Store Type</title>
		<subtitle>for stores whose profit margins are falling behind \rthe state average for each store type</subtitle>
		<notes>s24</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[Profit Percent]
		AS '(Measures.[Store Sales]-Measures.[Store Cost]) / (Measures.[Store Cost])', FORMAT_STRING = '#.00%'
SELECT
	NON EMPTY
	{
		[Store Type].[Store Type].MEMBERS
	}
	ON COLUMNS,
	FILTER
		(
			{
				[Store].[Store City].MEMBERS
			},
			(
				Measures.[Profit Percent], 
				[Time].[1997]
			) &lt;
			(
				Measures.[Profit Percent],
				[Time].[1997],
				ANCESTOR
					(
						[Store].CURRENTMEMBER, 
						[Store State]
					)
			)
		)
	ON ROWS
FROM [Sales] 
WHERE
	(
		Measures.[Profit Percent], 
		[Time].[Year].[1997]
	)
		</query>
	</slide>
 -->
	<!-- ==================================================================== -->
	<slide type="table">
		<title>Top Dozen Stores by Sales Count</title>
		<subtitle></subtitle>
		<notes>s25 Trick here was to properly format calculated member</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Unit Sales] 
		AS 'Measures.[Unit Sales]', FORMAT_STRING = '#,#'
	MEMBER Measures.[$Store Cost] 
		AS 'Measures.[Store Cost]', FORMAT_STRING = '$###,###'
	MEMBER Measures.[$Store Sales Net] 
		AS 'Measures.[Store Sales Net]', FORMAT_STRING = '$###,###'
	SET TopCities
		AS 'TOPCOUNT([Store].[Store City].MEMBERS, 12, [Sales Count])'
	MEMBER [Store].[Other Cities] 
		AS '([Store].[All Stores], Measures.CURRENTMEMBER) - SUM(TopCities, Measures.CURRENTMEMBER)'
SELECT
	{
		Measures.[$Unit Sales],
		Measures.[$Store Cost],
		Measures.[$Store Sales Net]
	}
	 ON COLUMNS,
	{
		TopCities,
		[Store].[Other Cities]
	}
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="table">
		<title>Sales Measures</title>
		<subtitle>for cities whose sales count accounts for 50 percent of all the sales</subtitle>
		<notes>s26</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Store Cost] 
		AS 'Measures.[Store Cost]', FORMAT_STRING = '$###,###'
	MEMBER Measures.[$Store Sales Net] 
		AS 'Measures.[Store Sales Net]', FORMAT_STRING = '$###,###'
SELECT
	{
		Measures.[Unit Sales],
		Measures.[$Store Cost],
		Measures.[$Store Sales Net]
	}
	ON COLUMNS,
	TOPPERCENT
		(
			{
				[Store].[Store City].MEMBERS
			},
			50,
			Measures.[Sales Count]
		)
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ====================================================================
	<slide type="table">
		<title>Breakdown of Store Sales Counts</title>
		<subtitle>by store type</subtitle>
		<notes>s27</notes>
		<query type="mdx">
SELECT
	{
		[Store Type].MEMBERS
	}
	ON COLUMNS,
	TOPPERCENT
		(
			{
				[Store].[Store City].MEMBERS
			},
			50,
			Measures.[Sales Count]
		)
	ON ROWS
FROM [Sales]
WHERE
	(
		Measures.[Unit Sales]
	)
		</query>
	</slide>
 -->
	<!-- ==================================================================== -->
	<slide type="packedbar" PlotBy="Column">
		<title>Unit Sales and Customer Count</title>
		<subtitle>by product category</subtitle>
		<notes>s28</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Unit Sales] 
		AS 'Measures.[Unit Sales]', FORMAT_STRING = '#,#'
	MEMBER Measures.[Customer Count]
		AS 'COUNT(CROSSJOIN({Measures.[Unit Sales]}, [Customers].[Name].MEMBERS), EXCLUDEEMPTY)'
SELECT
	{
		Measures.[$Unit Sales],
		Measures.[Customer Count]
	}
	ON COLUMNS,
	{
		HEAD ([Product].[Product Category].MEMBERS, 10)
	}
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="table">
		<title>Unit Sales and Percent of States Sales</title>
		<subtitle>by store</subtitle>
		<notes>s29 This would be great as a series of pie charts !!!</notes>
		<query type="mdx">
WITH
	MEMBER MEASURES.[Percentage Sales]
		AS '([Store].CURRENTMEMBER,MEASURES.[Unit Sales]) / ([Store].CURRENTMEMBER.PARENT,MEASURES.[Unit Sales])',FORMAT_STRING = '#%'
SELECT
	{
		MEASURES.[Unit Sales],
		MEASURES.[Percentage Sales]
	}
	ON COLUMNS,
	NON EMPTY
	{
		[Store].[Store City].MEMBERS
	}
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ====================================================================
	<slide type="table">
		<title>Percentage Profit for States</title>
		<subtitle>broken down by halfs and quarters (1997)</subtitle>
		<notes>s30 real crosstab - perhaps a heatmap?</notes>
		<query type="mdx">
WITH
	MEMBER MEASURES.[Percent Profit]
		AS '([Measures].[Store Sales]-[Measures].[Store Cost])/([Measures].[Store Cost])', FORMAT_STRING = '#%', SOLVE_ORDER = 1
	MEMBER [Time].[First Half 97] 
		AS  '[Time].[1997].[Q1] + [Time].[1997].[Q2]'
	MEMBER [Time].[Second Half 97]
		AS '[Time].[1997].[Q3] + [Time].[1997].[Q4]'
SELECT
	{
		[Time].[First Half 97],
		[Time].[Second Half 97],
		[Time].[1997].CHILDREN
	}
	ON COLUMNS,
	{
		[Store].[Store Country].[USA].CHILDREN
	}
	ON ROWS
FROM [Sales]
WHERE
	(
		MEASURES.[Percent Profit]
	)
		</query>
	</slide>
 -->
	<!-- ==================================================================== -->
	<slide type="packedcolumn">
		<title>Percentage Profit for States </title>
		<subtitle>months 1997</subtitle>
		<notes>s30 real crosstab - perhaps a heatmap?</notes>
		<query type="mdx">
WITH
	MEMBER MEASURES.[Percent Profit]
		AS '([Measures].[Store Sales]-[Measures].[Store Cost])/([Measures].[Store Cost])', FORMAT_STRING = '#%', SOLVE_ORDER = 1
SELECT
	{
		DESCENDANTS(
			[Time].[1997],
			[Time].[Month]
		)
	}
	ON COLUMNS,
	{
		[Store].[Store Country].[USA].CHILDREN
	}
	ON ROWS
FROM [Sales]
WHERE
	(
		MEASURES.[Percent Profit]
	)
		</query>
	</slide>
	<!-- ====================================================================
	<slide type="table">
		<title>Top Five Ranked Products by Department</title>
		<subtitle>by quarter in 1997</subtitle>
		<notes>s31</notes>
		<query type="mdx">
SELECT
	[1997].CHILDREN 
	ON COLUMNS,
	GENERATE(
		[Product Family].MEMBERS,
		{
			[Product].CURRENTMEMBER,
			TOPCOUNT(
				DESCENDANTS(
					[Product].CURRENTMEMBER, 
					[Product Name]
				),
				5,
				[Store Sales]
			)
		}
	)
	ON ROWS
FROM Sales
WHERE(
	[Store Sales]
)
		</query>
	</slide>
 -->
	<!-- ==================================================================== -->
	<slide type="bar" PlotBy="Column">
		<title>Aggregated Store Sqft Member Property</title>
		<notes>s32</notes>
		<query type="mdx">

WITH MEMBER [Measures].[StoreSqft] AS
	'IIF(
		([Store].CurrentMember.Level.Name="Store Name"),
      VAL(
			[Store].CurrentMember.Properties("Store Sqft")
		),
		SUM(
			DESCENDANTS(
				[Store].currentmember,[Store].[Store Name]
			),
			VAL(
				[Store].CurrentMember.Properties("Store Sqft")
			)
		)
	)'
SELECT
	{
		[Measures].[StoreSqft]
	}
	ON COLUMNS,
	FILTER(
		DESCENDANTS(
			[Store].[All Stores],[Store].[Store State]
		),
		[Measures].[StoreSqft] &gt; 0
	) 
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ====================================================================
	<slide display="false" type="table">
		<title>Unit Sales in My Stores</title>
		<notes>s33</notes>
		<query type="mdx">
WITH 
	MEMBER [Store].[MyStores] AS 
		'AGGREGATE(
			{
				[Store].[All Stores].[USA].[CA].[Beverly Hills].[Store 6], 
				[Store].[All Stores].[USA].[CA].[San Diego].[Store 24], 
				[Store].[All Stores].[USA].[OR].[Portland].[Store 11]
			}
		)'

SELECT
	{
		[Time].[1997]
	}
	ON COLUMNS , 
	NON EMPTY
	{
		[Customers].[All Customers].[USA].CHILDREN
	}
	ON ROWS 
FROM [Sales] 
WHERE (
	[Measures].[Unit Sales], [Store].[MyStores]
)
		</query>
	</slide>
 -->
	<!-- ==================================================================== -->
	<slide type="pie" PlotBy="Column">
		<title>Top Store Costs by City</title>
		<notes>s34 Try as pie</notes>
		<query type="mdx">
WITH
	SET Top5Cities AS
		'TOPCOUNT([Store].[Store City].MEMBERS, 5, [Store Cost])'
	MEMBER Measures.[$Store Cost] 
		AS 'Measures.[Store Cost]', FORMAT_STRING = '$###,###'
	MEMBER [Store].[Other Cities] AS
		'([Store].[All Stores], [Store Cost]) - SUM(Top5Cities, [Store Cost])'
SELECT
	{
		Measures.[$Store Cost]
	}
	ON COLUMNS,
	{
		Top5Cities, [Store].[Other Cities]
	}
	ON ROWS
FROM [Sales] 
		</query>
	</slide>
	<!-- ==================================================================== -->
	<slide type="line" PlotBy="Column">
		<title>Store Sales by Month</title>
		<subtitle>with +/- 3 St.Dev. Control</subtitle>
		<notes>
With [store sales] in the middle, I am getting format="#"
for the first column, because of my logic looking for
"IND" and setting value=0. The quick solution is perhaps
to make the [store sales] first - if this is the column
from which chart is getting its axis format.  I've comfirmed
that putting it first fixed the chart axis - so it looks
like it does indeed come from the first one.
		</notes>
		<query type="mdx">
WITH 
	MEMBER Measures.[$Store Sales]
		AS 'Measures.[Store Sales]', FORMAT_STRING = '$###,###'
	MEMBER [Measures].[Rolling Sales] AS 
		'AVG(LASTPERIODS(3), [Store Sales])'
	MEMBER [Measures].[Deviations] AS 
		'3 * STDDEV(LASTPERIODS(12), [Store Sales])'
	MEMBER [Measures].[Upper Limit] AS 
		'[Rolling Sales] + [Deviations]', FORMAT_STRING = '$###,###'
	MEMBER [Measures].[Lower Limit] AS 
		'[Rolling Sales] - [Deviations]', FORMAT_STRING = '$###,###'
SELECT
	{
		[$Store Sales], [Upper Limit], [Lower Limit]
	}
	ON COLUMNS,
	DESCENDANTS(
		[Time].[1997], [Time].[Month]
	)
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ====================================================================
	<slide type="line" PlotBy="Row">
		<title>Sales and Rolling Average Sales</title>
		<subtitle>For 12 months in 1997</subtitle>
		<notes>s36</notes>
		<query type="mdx">
WITH
	MEMBER Measures.[$Store Sales]
		AS 'Measures.[Store Sales]', FORMAT_STRING = '$###,###'
	MEMBER [Measures].[Rolling Avg] AS
		'AVG(LASTPERIODS(3), [Store Sales])', FORMAT_STRING = '$###,###'
SELECT
	DESCENDANTS(
		[Time].[1997], [Time].[Month]
	)
	ON COLUMNS,
	{
		[Rolling Avg], [$Store Sales]
	}
	ON ROWS
FROM [Sales]
		</query>
	</slide>
 -->
	<!-- ====================================================================
	<slide type="table">
		<title>Uses the LEAVES Flag</title>
		<subtitle>to Return the Bottom 10 Dimension Members</subtitle>
		<notes>s37</notes>
		<query type="mdx">
WITH 
	SET [NonEmptyEmployees] AS 
		'FILTER(
			DESCENDANTS(
				[Employees].[All Employees],
				10, 
				LEAVES
			),
			NOT ISEMPTY( [Measures].[Employee Salary]) 
		)'
SELECT
	{
		[Measures].[Employee Salary], 
		[Measures].[Number of Employees]
	}
	ON COLUMNS,
	BOTTOMCOUNT(
		[NonEmptyEmployees],
		10,
		[Measures].[Employee Salary]
	)
	ON ROWS
FROM [HR]
WHERE (
	[Pay Type].[All Pay Type].[Hourly]
)
		</query>
	</slide>
 -->
	<!-- ====================================================================
	<slide type="table">
		<title>Script for Finding 'Netz'</title>
		<notes>s38</notes>
		<query type="mdx">
SELECT
	[Time].[1997].Children
	ON COLUMNS,
	FILTER(
		[Customers].[Name].Members,
		InStr(1, [Customers].CurrentMember.Name, " Netz") &lt;&gt; 0
	)
	ON ROWS
FROM [Sales]
WHERE (
	[Unit Sales]
)
		</query>
	</slide>
 -->
	<!-- ==================================================================== -->
	<slide type="packedbar100" PlotBy="Column">
		<title>Store Sales Growth by Product</title>
		<subtitle>Month-to-Month 1997</subtitle>
		<notes>s39</notes>
		<query type="mdx">
WITH
	SET [Months] AS 
		'EXCEPT( DESCENDANTS([Time].[1997],[Time].[Month]), {[Time].[1997].[Q1].[1]} )'
	MEMBER [Measures].[Growth] AS 
		' ((Time.CURRENTMEMBER, [Store Sales]) - (Time.PREVMEMBER, [Store Sales])) / (Time.PREVMEMBER, [Store Sales])', FORMAT_STRING = '#.00%'
	MEMBER [Measures].[Avg Growth] AS 'Avg( [Months], [Growth] )'
	MEMBER [Measures].[Rem] AS '1 - [Avg Growth]'
SELECT 
	{
		[Avg Growth],
		[Rem]
	}
	ON COLUMNS,
	TOPCOUNT(
		[Product].[Product Category].MEMBERS,
		10,
		[Avg Growth]
	)
	ON ROWS
FROM [Sales]
		</query>
	</slide>
	<!-- ====================================================================
	<slide type="table">
		<title>Top Customer Percent at Risk</title>
		<notes>s40 This analytic takes time to run so it is commented out</notes>
		<query type="mdx">
WITH 
	MEMBER [Measures].[AmountAtRisk] AS
		' SUM( TOPCOUNT([Customers].[Name].MEMBERS, 1, [Store Sales]), [Store Sales] )'
	MEMBER [Measures].[PercentAtRisk] AS 
		' [AmountAtRisk] / ([Store Sales], [Customers].[All Customers] )', FORMAT_STRING = '#.00%'
SELECT
	{
		[AmountAtRisk], [PercentAtRisk]
	}
	ON COLUMNS,
	TOPCOUNT(
		[Product].[Product Name].MEMBERS,
		10,
		[PercentAtRisk]
	)
	ON ROWS
FROM [Sales]
		</query>
	</slide>
 -->
</slideset>

