《BI那点儿事》SSRS图表和仪表——雷达图分析三国超一流谋士、统帅数据(图文并茂)

雷达图分析三国超一流谋士、统帅数据,献给广大的三国爱好者们,希望喜欢三国的朋友一起讨论,加深对传奇三国时代的了解

建立数据环境:

-- 抽取三国超一流谋士TOP 10数据
DECLARE @t1 TABLE
    (
      [姓名] NVARCHAR(255) ,
      [统率] FLOAT ,
      [武力] FLOAT ,
      [智力] FLOAT ,
      [政治] FLOAT ,
      [魅力] FLOAT
    )
            
INSERT  INTO @t1
        SELECT TOP 10
                [姓名] ,
                [统率] ,
                [武力] ,
                [智力] ,
                [政治] ,
                [魅力]
        FROM    FactSanguo11
        WHERE   ( [智力] + [政治] > 160 )
                AND ( [智力] >= 90 )
                AND 姓名 <> N'曹操'
        ORDER BY [智力] + [政治] DESC

SELECT  *
FROM    @t1
 
-- 列转行处理
SELECT  [姓名] ,
        [指标项] = attribute ,
        [指标值] = value
FROM    @t1 UNPIVOT
  ( value FOR attribute IN ( [统率], [武力], [智力], [政治], [魅力] ) ) AS UPV

执行结果:

-- 抽取三国超一流统帅TOP 10数据
DECLARE @t2 TABLE
    (
      [姓名] NVARCHAR(255) ,
      [统率] FLOAT ,
      [武力] FLOAT ,
      [智力] FLOAT ,
      [政治] FLOAT ,
      [魅力] FLOAT
    )
    
INSERT  INTO @t2
        SELECT TOP 10
                [姓名] ,
                [统率] ,
                [武力] ,
                [智力] ,
                [政治] ,
                [魅力]
        FROM    FactSanguo11
        WHERE   [统率] + [武力] > 150
        ORDER BY [统率] + [武力] DESC

SELECT  *
FROM    @t2
 
-- 列转行处理
SELECT  [姓名] ,
        [指标项] = attribute ,
        [指标值] = value
FROM    @t2 UNPIVOT
  ( value FOR attribute IN ( [统率], [武力], [智力], [政治], [魅力] ) ) AS UPV

执行结果:

三国超一流谋士、统帅配图:


雷达图分析三国超一流谋士、统帅数据(最终客户端效果):


posted @ 2014-11-22 21:18 Bobby0322 阅读(...) 评论(...) 编辑 收藏