3

I have a columns in my dataset that will be returning several different values. In an attempt to to use grouping in the report I am trying to clean up the data. After reading several posts I found this post that seemed to be very close to what I needed.

I set up my expressions like this

=SWITCH(
Left(Fields!T6_TOW_BY.Value,3)="ACE","ACE WRECKER",
Left(Fields!T6_TOW_BY.Value,3)="CAR","CAR STORE",
Left(Fields!T6_TOW_BY.Value,7)="THE CAR","CAR STORE",
Fields!T6_TOW_BY.Value

)

The expression does not throw an error when I preview it, but all the columns show "error" Can anyone please show me where I am going wrong here?

Thanks

Community
  • 1
  • 1
Perry
  • 1,277
  • 2
  • 17
  • 39
  • The part `,Fields!T6_TOW_BY.Value` looks like unneeded code. Try it without that. – R. Richards Jul 21 '16 at 19:51
  • thanks for the quick response R.Richards. I removed that line and it now runs, but is only showing the three I have put in the switch statement. I though the line I removed would show any records I did not catch in the SWITCH – Perry Jul 21 '16 at 19:56
  • 1
    Unfortunately, it doesn't work like that. I wish it did. Having a default when nothing else matches would be a nice feature. – R. Richards Jul 21 '16 at 20:02

1 Answers1

10

The Switch statement requires pairs of arguments. You can't just have the last value by itself as an Else condition. Try this:

=SWITCH(
Left(Fields!T6_TOW_BY.Value,3)="ACE","ACE WRECKER",
Left(Fields!T6_TOW_BY.Value,3)="CAR","CAR STORE",
Left(Fields!T6_TOW_BY.Value,7)="THE CAR","CAR STORE",
True, Fields!T6_TOW_BY.Value
)
StevenWhite
  • 5,907
  • 3
  • 21
  • 46