Calvin

Calvin Ferns' Blog

KPI’s in Power View and DAX Query for KPI’s

I was recently approached by a client where we have assisted in implementing a Microsoft Analysis Services tabular solution and a supporting management pack of SSRS reports.  They were asking about utilising some of the KPI’s defined in their tabular cube in the SSRS reports using DAX queries.  I was at a bit of a loss and most web help seemed to suggest it couldn’t be done:

Blog comment from 2012

However, with a bit of time to investigate it appears Power View does now support Tabular KPI’s and as such a DAX query should be able to pull them out. 

image

My KPI base measure is named “Highest Ranking” and I am able to view its value, status or goal in Power View.  A little work with every SQL developer’s best friend Profiler and I had what I was looking for.  It appears that when you create a KPI SSAS is defining some measures in the background which do some of the work of the MDX KPI functions.

Therefore the following DAX query against my cycling Demo cube contains the expected results and could therefore be used in SSRS reporting.

EVALUATE ADDCOLUMNS(
VALUES('DimRider'[Name])

,

"Highest_Ranking", 'FactRanking'[Highest Ranking],

"Highest_Ranking_Goal", 'FactRanking'[_Highest Ranking Goal],

"Highest_Ranking_Status", 'FactRanking'[_Highest Ranking Status]

)

ORDER BY 'DimRider'[Name]

 

I also tested for the existence of other KPI functions such as Trend and Weight but these do not appear to be present.  It is also interesting that the use of a KPI over a measure does not change the measure name but just group it in the field list and as such there is no need for a value function.

image

For more info on KPI’s in Power View there is additional documentation here.  I am currently unsure of the required versions for this functionality so if it is missing from your environment I would love to hear from you.