Sorting dynamically calculated columns

Welcome to our Forums Technical Support Support Desk Sorting dynamically calculated columns

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4341
    Jean-Yves Le Stang
    Participant

      Hi, DG Team,

      In the capture below, “Country” and “ContaminationRisk” are unsorted data generated by mapping (Country) and last column value with moving average (ContaminationRisk).

      I would like to represent the two sorted columns on a bar graph.

      I can sort ContaminationRisk using the “ContaminationRisk(ContaminationRisk.sortwith)” function

      However, when I try to sort Country using “Country(ContaminationRisk.sortwith)”, I fail, may be because “.sortwith” is not applicable to a text column ?

      I also tried going through using the “sortedindex” with no success.

      Can you help ?

      Graph

      #4342
      dgteam
      Moderator

        One way to do this is by using a look-up-table (LUT) to go between your text category and a numerical ID.

        Here is a general example of a LUT.

        LUT1

        Map the ID to your unsorted data:

        LUT2

        Then use the ID with the ‘sortwith’ column property and another map column to recover the text category.

        LUT3

        Another quick way is to use the Pivot command.

        You can use the Pivot as a pass through to do the sorting.  If needed you can also extract the data back to the data table.   For example, if you want to have a different color bar depending on the category, plot the extracted data using a Bar command.

        We just posted a step-by-step example using the Pivot command to sort, in File/On-line examples.

        SortwithPivot

        Hope this helps!

        #4343
        Jean-Yves Le Stang
        Participant

          Many thanks for prompt and useful advice

        Viewing 3 posts - 1 through 3 (of 3 total)
        • You must be logged in to reply to this topic.

        Welcome to our Forums Technical Support Support Desk Sorting dynamically calculated columns