Sunday, February 19, 2012

HOW to browse KPI's Result Data through ADOMD.NET?

Hi,

My question is how to browse KPI's Result through ADOMD.NET? I mean to get a KPI's Result Data, not get the metadata of KPI, not get the KPI's Value Property(String) either.

I see the MSDN said about AdomdDataReader, but it doesnt tell how to get a KPI's Value.

I guess, I need to get KPI's metadata first, and get a KPI's Value Property, that's a MDX, you know. Then I bring the MDX to the AS server, and get the result. Is it right?

But, if so, when i want to slice on a dimension when I check the KPI's result, how could I do? I have got a KPI's Value Property MDX, then I need to modify the MDX to add the dimension slice to it manually?

Thanks.

Via an MDX query, you can retrieve the various values associated with a KPI using the KPIValue(), KPIGoal(), KPIStatus(), and KPITrend() functions. Here's the link in Books Online for hte KPIValue() function, for example:

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/mdxref9/html/c4f8532c-4c24-4ad5-8847-4522511e0039.htm

If you wanted to slice the KPI values by a given dimension value, you'd just add that to your MDX statement. For example, the following MDX query returns various KPI values for each of the quarters in 2004:

SELECT

{ KPIValue("Internet Revenue"),

KPIGoal("Internet Revenue"),

KPIStatus("Internet Revenue"),

KPITrend("Internet Revenue")

} ON Columns,

Descendants

( { [Date].[Fiscal].[Fiscal Year].&[2004]

}, [Date].[Fiscal].[Fiscal Quarter]

) ON Rows

FROM [Adventure Works]

If you wanted to slice that so that you only get the KPI values filtered by the product category "Bikes", then you could do this:

SELECT

{ KPIValue("Internet Revenue"),

KPIGoal("Internet Revenue"),

KPIStatus("Internet Revenue"),

KPITrend("Internet Revenue")

} ON Columns,

Descendants

( { [Date].[Fiscal].[Fiscal Year].&[2004]

}, [Date].[Fiscal].[Fiscal Quarter]

) ON Rows

FROM [Adventure Works]

WHERE

([Product].[Category].[Bikes])

HTH,

Dave F.

|||Thank you very much! This is what I just want.

No comments:

Post a Comment