sql server - Matrix table with different values in different rows and sum them in SSRS -


i have create ssrs report below one.entered city & leaved city b in 1 matrix , leaved city c in different matrix table. , these fields getting dataset , last % field calculated 1 a/c. since in different matrix table not able value doing calculation.

information         january february    march   april   may june    july    august  entered city                                  leaved city         b       total counts , entered % of counts mentioend below                     total count in city      c                           %of ppl entered         a/c                          

the reason using 2 datasets having separate heading @ middle of table. please suggest on this

one way accomplish creating hash table in report code store city values , city values needed. report code below:

dim citytotals system.collections.hashtable  public function addcityvalues(byval city object, byval amount object)         if (citytotals nothing)             citytotals = new system.collections.hashtable         end if         if (not citytotals.contains(customer))             citytotals.add(city, amount)        end if addcityvalues = amount end function  public function getcityvalues(byval city)     if (not citytotals.contains(city))         getcityvalues = 0     end if                 if (citytotals.contains(city))             each citypair system.collections.dictionaryentry in citytotals                 if citypair.key.tostring() = customer                 getcityvalues = citypair.value             end if         next         end if end function 

in report expression, in order add values hash table use addcityvalues function so:

=code.addcityvalues(fields!cityname.value,fields!amount.value) 

in order values later in report use getcityvalues so:

=code.getcityvalues(fields!cityname.value) 

you can make string key concatenated values in order store , more granular data.


Comments