
I was recently asked to prepare a report that would divide by data set into distinct categories. Each category would then drill down into a sub report with details. The categories were alphanumeric, which initially posed a problem as they needed to be sorted according to the numeric values inherent in the category. In this case, 2 would be preceded by 23, then 6, where I needed the 23 to come after the 6. Here is the formula for the categories, which is based upon a formula calculating the seconds between date times:

In Group Expert there is an option to “Use a Formula as Group Sort Order”, however it’s implementation is limited in that the formula must return a specific ordering constant. This didn’t apply in my case. Fortunately what I discovered a solution. By creating your own formula without constraints, it can be applied as the sorted and grouped by option in Change Group Options of Group Expert. I used the same time constants in my original formula to determine the sort order:

I was then able to apply this formula as the grouping and sorting for the group:

The effect was as desired:

The next request was to create a summarized Cross-Tab of the same information. Again, using the categories resulted in incorrect sorting. I was able to use the sort order formula for the grouping, but this would then display the values of the sort order, and not the categories. I was kind of backwards from where I started. Poking around the Cross-Tab Expert, I found that you can customize the group name by using a formula, which in my case was the formula that produced the alphanumeric categories:
