cancel
Showing results for 
Search instead for 
Did you mean: 

Concatenated List sorting

jtylerrand
Member
0 Kudos
228

I have a table with a Location, Country, Year, Month, and Total(Integer).

I need to create a concatenated list of all of the countries per location, with the total.

The intended final product would look like this:

Year Location Month Countries

2023 SPW October Mexico(14), Honduras(9), Canada(1), Colombia(1)

I can concatenate the list already, to include the totals, but the order is in descending Alphabetical Order:

I am using the following Variables:

CITIZENSHIPS - Dimension

=If(IsNull(Previous([MAX_CONCAT_CITIZENSHIP]));Substr([MAX_CONCAT_CITIZENSHIP];1;Length([MAX_CONCAT_CITIZENSHIP])-2);Substr([MAX_CONCAT_CITIZENSHIP];1;Pos([MAX_CONCAT_CITIZENSHIP];Previous([MAX_CONCAT_CITIZENSHIP]))-3))

MAX_CONCAT_CITIZENSHIP - Dimension

=[CONCAT_CITIZENSHIP] Where([Subject Citizenship Code]=[MAX_CITIZENSHIP])

CONCAT_CITIZENSHIP- Dimension

=[Subject Citizenship Code] + " (" + [TOTAL] + ")" + ", " + Previous(Self)

MAX_CITIZENSHIP - Measure

=Max([Subject Citizenship Code]) In ([Fiscal Year];[Sector];[Month])

I realize the CONCAT_CITIZENSHIP variable is what is sorting the list of citizenships in ascending order.

Also that the MAX_CONCAT_CITIZENSHIP variable is what "stops" the concatenation list at the correct point.

What I can't seem to figure out is if there is a way to sort the final list by the Totals in descending order, and ideally if there is a tie, to then sort alphabetically.

I realize that this may not be possible, but I thought I would ask. Thanks.

Accepted Solutions (0)

Answers (0)