我在该查询中编写了命名查询,我有request_id,createddate,confirmeddate,reporteddate,sitename,ticketstatusname等属性......
我想知道request_id的ticketstatusname,即打开或关闭。我已过滤日期为ReportedDate =' 2011-07-31 00:00:00.000'对于特定日期,我想知道有多少request_id正在打开以及每个网站关闭了多少个。例如,sitename =' BOUZ'包含25个request_id的是打开的,225个request_id被关闭。同样的查询我已经在ssas立方体中复制和过去,当我拖放sitename,ticketstatusname到立方体浏览器时,我正在处理我正在计数但是ticketstatusname我错了,即实际关闭的门票显示在打开状态。你可以帮助我为什么我的ssas立方体中的请求id id的错误状态。以下是命名查询。
从
中选择*(SELECT d.Short_sitename as Sitename,f.Request_ID,dt3.FullDateAlternateKey AS CreatedDate, dt2.FullDateAlternateKey AS ConfirmedDate,dt1.FullDateAlternateKey AS ReportedDate,
CASE WHEN(dt2.FullDateAlternateKey为null)或(dt1.FullDateAlternateKey
DimSite as d on d.Site_ID=f.Site_ID LEFT OUTER JOIN
DimTime AS dt1 ON dt1.FullDateAlternateKey BETWEEN dt3.FullDateAlternateKey AND DATEADD(d, - 1, DATEADD(mm, DATEDIFF(m, 0,
ISNULL(dt2.FullDateAlternateKey, GETDATE())) + (12 - MONTH(ISNULL(dt2.FullDateAlternateKey, GETDATE())) + 1), 0))
WHERE(dt1.FullDateAlternateKey = DATEADD(d, - 1,DATEADD(mm,DATEDIFF(m,0,dt1.FullDateAlternateKey)+ 1,0)))AND(f.Type_ID1 IS NOT NULL)AND (f.Type_ID2 IS NOT NULL)AND(f.Type_ID3 IS NOT NULL) )一个 其中ReportedDate =' 2011-07-31 00:00:00.000'和sitename =' BOUZ'