reporting services - Simple indicator comparing last two sums of a Matrix -
i have following matrix displaying datas of last 3 days:
date 05/07/2015 06/07/20145 07/07/215 number 151 42 84 the field number in each column calculated using this:
=sum(fields!number.value) what want simple indicator (an arrow going or down) comparing last 2 values of matrix.
ie in case: 84 > 42, have arrow going up.
if tomorrow have this:
date 06/07/2015 07/07/20145 08/07/215 number 42 84 35 35 < 84, have arrow going down.
i not sure wich value should put in value property of indicator last value , compare second last value...
thanks help.
i'm not sure can reference specific indices column group.
if can change sql , add row number gives same row numbers values want compare can following.
in example built simple table, grouped colgroup (which dates) , added row number based on colgroup. note: order clause on row_number function set desc no matter how many days show, report can compare rownum 1 rownum 2
first, create report single matrix , single dataset.
query dataset:
create table #t (colgroup char(1), number int) insert #t values ('a', 12),('a', 13),('a', 14) , ('b', 15),('b', 16),('b', 17) , ('c', 18),('c', 19),('c', 20) select * , row_number() over(order colgroup desc) rownum ( select colgroup, sum(number) totalnumber #t group #t.colgroup ) x now create report containing single matrix. drag colgroup field columns area drag totalnumber field data area
now we'll add 2 columns, 1 show actual difference between last 2 values (for illustration only) , show indicator displaying >, = or <
right-click column header of column containing [colgroup] , "insert column" "outside group - right"
repeat create 2 columns
in first of new columns set expression this:
= sum(iif(fields!rownum.value=1, fields!totalnumber.value, 0))- sum(iif(fields!rownum.value=2, fields!totalnumber.value, 0)) in second, set expression this:
= iif( sum(iif(fields!rownum.value=1, fields!totalnumber.value, 0))- sum(iif(fields!rownum.value=2, fields!totalnumber.value, 0))>0 , ">" , iif( sum(iif(fields!rownum.value=1, fields!totalnumber.value, 0))- sum(iif(fields!rownum.value=2, fields!totalnumber.value, 0))=0 , "=" , "<") ) run report , you'll output want (i hope!)
i suggest creating function don't have repeat al sum(iif.. code on , on that's down you.
hope helps.
Comments
Post a Comment