Distinct Sum
Hi, My table looks like below id Asset Cash 11 110 2 11 110 3 11 110 5 22 220 5 22 220 5 22 220 5 I like to have report like below id Sum(Asset) Sum(Cash) 11 110 10 22 220 15 I like to have a code for Sum(Asset) Column like below : for distinct id, Sum(Field.Asset.Value) simam
November 5th, 2011 3:19pm

select ID, Asset, sum(Cash) as CashTotal from Assets GROUP BY ID, Asset For every expert, there is an equal and opposite expert. - Becker's Law My blog
Free Windows Admin Tool Kit Click here and download it now
November 5th, 2011 7:43pm

In you example logic for Asset is not clear. For distinct id and asset: select ID, Asset, sum(Cash) as sumCash from table group by ID, Asset If you wish one row per id you may try select ID, MIN(Asset) AS MinAsset, sum(Cash) as sumCash from table group by ID
November 5th, 2011 8:44pm

Actually I am looking for the code. Based on my example Sum(Field.cash.Value) is working perfectly for cash Column. But for Asset Column I like to Distinct id before Sum(Filed.Asset.value) . Right now when I sum the Asset(SUM(FIELD.ASSET.VALUE) for ID 1 value is 330 instead of 110simam
Free Windows Admin Tool Kit Click here and download it now
November 5th, 2011 8:59pm

In SSRS you can do First(FIELD.ASSET.VALUE), it will display first value of the Asset for the group.
November 5th, 2011 9:03pm

So wht will be my code. First(Field.Asset.Value) ,Sum(Field.Cash.Value)?simam
Free Windows Admin Tool Kit Click here and download it now
November 6th, 2011 7:06am

Hi Shimam, After adding a table to the report, create a group for the table on ID. For the next columns, Asset use First(First!Asset.Value), Cash, use Sum(Fields!Cash.Value) Hope this help!
November 6th, 2011 5:19pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics