Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reporting services SSRS/矩阵中的Unpivot_Reporting Services_Ssrs 2017 - Fatal编程技术网

Reporting services SSRS/矩阵中的Unpivot

Reporting services SSRS/矩阵中的Unpivot,reporting-services,ssrs-2017,Reporting Services,Ssrs 2017,我试图在SSRS中解压一些数据,但我很难得到我想要的格式。我当前的表格和数据如下所示:- CREATE TABLE [dbo].sampledata( [DDMMMYY] [date] NULL, [DayN] [nvarchar](4000) NULL, [CArticle] [int] NULL, [TU] [int] NULL, [Pieces] [int] NULL, [ActualSpace] [int] NULL, [InternalCore] [int] NULL, [Quaran

我试图在SSRS中解压一些数据,但我很难得到我想要的格式。我当前的表格和数据如下所示:-

CREATE TABLE [dbo].sampledata(
[DDMMMYY] [date] NULL,
[DayN] [nvarchar](4000) NULL,
[CArticle] [int] NULL,
[TU] [int] NULL,
[Pieces] [int] NULL,
[ActualSpace] [int] NULL,
[InternalCore] [int] NULL,
[QuarantinedStock] [int] NULL,
[AvailableSpace] [int] NULL
)


insert into sampledata (DDMMMYY, DayN, CArticle, TU, Pieces, ActualSpace, InternalCore, QuarantinedStock, AvailableSpace)
VALUES
('2019-09-13','Fri','848','20403','1249144','59790','17652','433','0'),
('2019-09-16','Mon','878','21328','1253811','63133','18908','429','0'),
('2019-09-17','Tue','892','21106','1253607','61770','18780','402','0'),
('2019-09-18','Wed','910','20948','1250381','61543','18485','955','0'),
('2019-09-19','Thu','863','20351','1243131','60235','18845','627','0'),
('2019-09-20','Fri','847','19923','1242594','59565','19460','1385','0'),
('2019-09-23','Mon','863','20862','1254736','62773','18362','1418','0'),
('2019-09-24','Tue','860','20592','1259028','62864','19972','1422','0'),
('2019-09-25','Wed','871','20646','1273306','63079','20498','1430','0'),
('2019-09-26','Thu','875','20424','1264449','61508','20040','1430','0'),
('2019-09-27','Fri','884','20581','1277418','62128','20287','1430','0'),
('2019-09-30','Mon','873','21684','1341305','66764','22666','1266','0');
我将永远不会返回超过31天的数据

我要做的是取消打印数据,但根据日期保留组,完成后,我的数据应如下所示:-

我希望日期在我的数据顶部,标题在左侧,例如TU、碎片等,最初我使用unpivot,但由于有多天,数据没有像我希望的那样向右延伸

我曾尝试使用SSRS矩阵,但仍难以获得所需的输出


任何帮助都将不胜感激。

以下是我将如何为您的数据解压:

SELECT DDMMMYY, DayN, TypeCount, DataType
FROM #sampledata
UNPIVOT (TypeCount FOR DataType IN (CArticle
      ,TU
      ,Pieces
      ,ActualSpace
      ,InternalCore
      ,QuarantinedStock
      ,AvailableSpace )
      ) u 

就我个人而言,我只会使用一个日期字段,让SSR计算出今天是哪一天(周一、周二…),而不是使用DayN字段。

我现在已经通过SSR和表格矩阵实现了我想要做的事情,以前我在不应该的时候将我想要的字段添加到单独的组中,很长一段时间以来,我在SSRS方面做了很多工作。不过,如果使用tsql代码可以实现预期的结果,我会很感兴趣。