SSRS停止将月份转换为名称

时间:2017-02-03 17:02:43

标签: sql-server reporting-services ssrs-2012

我在SSRS 2012中遇到一个问题,这可能是世界上最容易解决的问题,但对于我的生活,我在这个问题上迷失了。

背景:我正在从一个类似于此的表格中在SSRS中创建折线图:

SELECT TOP 100
n.Node_Category_CP
,r.DateTime
,Availability
FROM ResponseTime r
JOIN NodesCustomProperties n ON n.NodeID = r.NodeID
WHERE n.Node_Category_CP IN ('Network','Servers','Voice')
AND r.DateTime >= DATEADD(Month,-12,(DATEADD(MONTH,DATEDIFF(MONTH,0,GETDATE()),0))) AND r.DateTime < (DATEADD(MONTH,DATEDIFF(MONTH,0,GETDATE()),0))

Source Table - IMAGE

现在,我在SSRS中创建了一个数据集,以便加载到我的图表中:

SELECT
    x.Team
    ,x.Month
    ,AVG(x.Availability) AS 'Availability'
FROM
    (
        SELECT
            n.Node_Category_CP AS 'Team'
            ,CONCAT(DATEPART(MONTH,r.DateTime),' - ',DATEPART(YEAR,r.DateTime)) AS 'Month'
            ,CAST(r.Availability AS NUMERIC) 'Availability'
        FROM ResponseTime r
        JOIN NodesCustomProperties n ON n.NodeID = r.NodeID
        --Last 12 Months
        WHERE r.DateTime >= DATEADD(Month,-12,(DATEADD(MONTH,DATEDIFF(MONTH,0,GETDATE()),0))) AND r.DateTime < (DATEADD(MONTH,DATEDIFF(MONTH,0,GETDATE()),0))
        AND n.Node_Category_CP IN ('Network','Servers','Voice')
    ) AS x
GROUP BY x.Team,x.Month
ORDER BY DATEADD(DAY,-1,DATEADD(MONTH,1,CONVERT(DATETIME,'1/'+x.Month,103))) ASC

结果:

Team        Month       Availability
Network     2 - 2016        99.682518
Servers     2 - 2016        99.882986
Voice       2 - 2016        99.983606
Network     3 - 2016        99.213777
Servers     3 - 2016        99.997749
Voice       3 - 2016        99.953615
Network     4 - 2016        99.955140
Servers     4 - 2016        99.997766
Voice       4 - 2016        99.967692
Network     5 - 2016        99.940809
Servers     5 - 2016        99.663747
Voice       5 - 2016        99.464872
Network     6 - 2016        99.929164
Servers     6 - 2016        99.919462
Voice       6 - 2016        99.868244
Network     7 - 2016        99.853899
Servers     7 - 2016        99.999429
Voice       7 - 2016        99.968734
Network     8 - 2016        99.895597
Servers     8 - 2016        99.996016
Voice       8 - 2016        99.979156
Network     9 - 2016        99.925720
Servers     9 - 2016        99.990673
Voice       9 - 2016        99.901025
Network     10 - 2016       99.926707
Servers     10 - 2016       99.987152
Voice       10 - 2016       99.946401
Network     11 - 2016       99.708962
Servers     11 - 2016       99.968975
Voice       11 - 2016       99.863076
Network     12 - 2016       99.497376
Servers     12 - 2016       99.944684
Voice       12 - 2016       99.968642
Network     1 - 2017        99.543326
Servers     1 - 2017        99.980901
Voice       1 - 2017        99.960373

因此,根据这些数据,我使用SSDT在SSRS中创建了一个简单的折线图,其中包含以下几点:

  • 类别组:月
  • 类别排序:无
  • 水平轴选项:
    • 轴类型:类别
    • 轴间隔:1
    • 间隔类型:默认

请注意,我尝试了Inteval和Interval Type的几种变体而没有可靠的结果。

现在,问题是,每一次,任何组合,标签都返回为月份名称,没有年份,并按字母顺序排序。

Preview of Final Chart - IMAGE

我希望看到的数字月份和年份(MM - YYYY)以及我的数据集结果中的排序顺序(日历顺序1/2/3/4/5/6/7/8 / 9/10/11/12),但只要它们实际上是按日历顺序,我看到月份名称就100%正确...

任何和所有帮助将不胜感激!

0 个答案:

没有答案