Appendix B: MDX Queries for PowerPivot 411
KPI Query
with member [Measures].[Actual] as
KPIValue("Product Gross Profit Margin"),format_string = "Percent"
member [Measures].[Target] as
KPIGoal("Product Gross Profit Margin"),format_string="Percent"
member [Measures].[Status] as
KPIStatus("Product Gross Profit Margin")
member [Measures].[Trend] as
KPITrend("Product Gross Profit Margin")
select {crossjoin({[Date].[Fiscal].[Fiscal Year].[FY 2003],
[Date].[Fiscal].[Fiscal Year].[FY 2004]},{[Measures].[Actual],
[Measures].[Target],[Measures].[Status],[Measures].[Trend]})}
on columns,
{[Product].[Product Categories].[Category].members} on rows
from [Adventure Works]
This is how you pull key performance indicators (KPIs) out of the SSAS cube. It’s
valid MDX but doesn’t look that good in a PowerPivot table. It’s the same problem as
before, with the non-measure dimensions on the Columns axis. The resulting table is
shown in Figure B-18.
KPI Query Rewritten to Give Better Results
with member [Measures].[Actual] as
KPIValue("Product Gross Profit Margin"),format_string = "Percent"
member [Measures].[Target] as
KPIGoal("Product Gross Profit Margin"),format_string="Percent"
member [Measures].[Status] as
KPIStatus("Product Gross Profit Margin")
member [Measures].[Trend] as
KPITrend("Product Gross Profit Margin")
select {[Measures].[Actual],
[Measures].[Target],[Measures].[Status],[Measures].[Trend]}
Figure B-18 PowerPivot table