You need to build up the query in a local variable:
Public Function Custom_sort(ByVal dt As DataTable) As DataView
Dim rows As OrderedEnumerableRowCollection = dt.AsEnumerable().
OrderBy(Function(row) String.IsNullOrWhiteSpace(row.Field(Of String)("Employee_SSN")))
If dt.Columns.Contains("Group_number") Then
rows = rows.ThenBy(Function(row) String.IsNullOrWhiteSpace(row.Field(Of String)("Group_number")))
End If
Return rows.AsDataView()
End Function