How can I assign a normal table from a dynamic pivot table?

前端 未结 3 1123
遇见更好的自我
遇见更好的自我 2020-12-22 10:58

I need to make a report in Stimulsoft from the last 12 months from our current date, I used dynamic pivot table to make this, the original table is at figure 1

3条回答
  •  伪装坚强ぢ
    2020-12-22 11:24

    As a way, you can use the master-detail report in Stimulsoft tool. As master table you can use the table with date only:

    SELECT CONVERT(DATE, DATEADD(MONTH, DATEDIFF(MONTH, 0, CURRENT_TIMESTAMP) - (12 - Number), 0), 103) AS DT,
           CONVERT(VARCHAR(2),MONTH(DATEADD(MONTH, DATEDIFF(MONTH, 0, CURRENT_TIMESTAMP) - (12 - Number), 0))) + CONVERT(VARCHAR(4),YEAR(DATEADD(MONTH, DATEDIFF(MONTH, 0, CURRENT_TIMESTAMP) - (12 - Number), 0))) As MonthYear
      FROM Master..spt_values
     WHERE Type = 'P'
           AND number BETWEEN 0 AND 12
    

    The detail table it's "yourTable" with additional column:

    select *, convert(varchar(2),Month(DACP_date)) + convert(varchar(4),Year(DACP_date)) as MonthYear from yourtable
    

    realtion on MonthYear columns. In report you can use the Cross-Data component for master data, and DataBand component for detail data. Please see the image from the following link: http://imgur.com/Ve03BXU

提交回复
热议问题