SSRS正在删除分组

时间:2015-04-22 13:34:27

标签: sql ssrs-2008-r2

我有一份SSRS报告,其中包含以下查询:

SELECT DISTINCT
Rtrim(ltrim(CUSTNAME)) as 'CUSTNAME',
ItemName,
ISNULL(NAME, LOGCREATEDBY) AS 'Modified By'
,b.ITEMID as 'Item Id'
,[PRICE_NEW] as 'New Price'
,[PRICE_OLD] as 'Old Price'
,[PRICEUNIT_NEW] as 'New Unit Price'
,[PRICEUNIT_OLD] as 'Old Unit Price'
,LOGCREATEDDATE as 'Created Date' 
,LOGCREATEDTIME
,(select Description from Dimensions where a.Dimension2_ = Dimensions.Num) as 'Division'
,(Select TOP 1 INVENTTRANS.DATEFINANCIAL From INVENTTRANS Where 

INVENTTRANS.ITEMID = B.ITEMID and InvoiceID like 'Inv%' order by INVENTTRANS.DATEFINANCIAL desc) As 'LastInvoice'
FROM PMF_INVENTTABLEMODULELOG AS b
    LEFT JOIN USERINFO ON ID = LOGCREATEDBY
    LEFT JOIN INVENTTABLE AS a on a.ITEMID in (b.itemId)
WHERE LOGCREATEDDATE between @beginCreatedDate and @endCreatedDate
and a.dimension2_ in (@dimension)
order by LOGCREATEDDATE,LOGCREATEDTIME  desc

简而言之,它会通过一个表格并选出一个项目编号并列出该项目的每个价格变化。 查询,wen run,将返回如下内容:

    CUSTNAME   |  Modified By  |  Item ID |  New Price |  Old Price
------------------------------------------------------------------
Performance        Joe             12345       21.50        21.49
Performance        Mary            12345       21.49        19.10

(这恰好是造成问题的回报)

我的报告按部门列出每一行,客户名称和项目编号。问题是,当我有一个项目ID组时,它会累计总数(有意义)所以我摆脱了项目编号组,但现在每个客户只会列出一个项目!

它应该在示例中显示Performance的两行,但是它不会列出。我希望它能为每位客户显示每一行。它必须是ITEM ID组,但我似乎无法做到正确。

enter image description here

1 个答案:

答案 0 :(得分:0)

不要删除该组,而是将其更改为显示详细数据。

右键单击组选择“组属性”,然后选择“组合”表达式。然后单击“删除”按钮。然后它将不再求和,因为它是一个细节组。

我建议您从相关表达式中删除sum,以避免混淆,因为它们只会将单个值相加,但会使其看起来不同。