sql server - Sum of one field minus sum of another SSRS Expression -


i have ssrs report i'm working on. value of 1 field own dataset , subtract value of field different dataset. can this; however, values grouped rather giving me individual value gives me: (sum of all completed) - (sum of all completed previous year). enter image description here

here expression using column "compared last year"

=sum(fields!completed.value, "mtdsales") - sum(fields!completed.value, "mtdminus1") 

"mtdsales" , "mtdminus1" 2 seperate datasets. mtdsales dataset current months sales outcomes grouped company mtdminus1 dataset last years figure current month comparing 2 months separately.

i had in report pulling current data 1 database , older data data warehouse , combining. need few things:

1. establish match field

this can simple single column. if need match on multiple fields need add calculated field each dataset can match on. assuming need match on company , financial year , each dataset returns 1 year of data, might match_id (assuming numeric values - otherwise might need use | or separator):

`="a" & fields!fin_year.value & "b" & fields!cust_id.value` 

2. retrieve data source field.

in tablix add column have hold looked value:

=lookup(fields!matchid.value, fields!matchid.value, fields!completed.value, "mtdminus1") 

3. use data

now can aggregate data or whatever further calculations wish if field part of original dataset.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -