Based on your above data, I would use a couple of Calculated Fields and apply two groupings based on these.
Using the above data (plus a few more rows for demonstration):
I've added two Calculated Fields:
Group
=Switch(Left(CStr(Fields!Task_Code.Value), 2) = "51", "Group1"
, Left(CStr(Fields!Task_Code.Value), 2) = "52", "Group2"
, Left(CStr(Fields!Task_Code.Value), 2) = "62", "Group3")
Location
=Switch(Fields!Task_Code.Value >= 5100 and Fields!Task_Code.Value <= 5900, "Location1"
, Fields!Task_Code.Value >= 6200 and Fields!Task_Code.Value <= 6500, "Location2")
For Location
, I've assumed that Task_Code
is integer based; you could always use CInt
as required if this is not the case.
I've created a table with a Details group and two groups based on the Calculated Fields:
Results looks like the requirements: