Using SWITCH statement to return values in matrix
I need to use a switch statement to return the summation of values in a matrix cell so that they are based on a particular quarter. My statement is: SWITCH( DatePart(DateInterval.Quarter, Today()) =1 and Fields!q.Value=1, sum(Fields!PmsOpen.Value), DatePart(DateInterval.Quarter, Today()) =2 and Fields!q.Value=2, sum(Fields!PmsOpen.Value), DatePart(DateInterval.Quarter, Today()) =3 and Fields!q.Value=3, sum(Fields!PmsOpen.Value), DatePart(DateInterval.Quarter, Today()) =4 and Fields!q.Value=4, sum(Fields!PmsOpen.Value)) However SSRS is returning an error that the "textbox references a field outside an aggregate function. Value expressions in matrix cells should be aggregate, to allow for subtotaling" Can anyone advise me on the best way to handle this?Eyespi20
May 12th, 2011 11:09am

Could you try the expression below? SUM(SWITCH( DatePart(DateInterval.Quarter, Today()) =1 and Fields!q.Value=1, Fields!PmsOpen.Value, DatePart(DateInterval.Quarter, Today()) =2 and Fields!q.Value=2, Fields!PmsOpen.Value, DatePart(DateInterval.Quarter, Today()) =3 and Fields!q.Value=3, Fields!PmsOpen.Value, DatePart(DateInterval.Quarter, Today()) =4 and Fields!q.Value=4, Fields!PmsOpen.Value))Remember to mark as an answer if this post has helped you.
Free Windows Admin Tool Kit Click here and download it now
May 12th, 2011 12:01pm

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

Other recent topics Other recent topics