1 Reply Latest reply on Jul 25, 2016 2:34 PM by Yuriy Fal

    Need help sorting blended data

    d Vermaak

      Hello everyone,

      I need help sorting blended data. I have 2 dimensions and 1 measure: a date field, location hierarchy, and 1 calculated fields.

      I am needing to sort the calculated field in descending order. I've gone through some of the older posts and found a trick where you create another calculated field that is basically (-[calculated field]), convert that to discrete, drag before other dimensions, hide header, and now you have a descending sort. However, because I have 2 dimensions, the sort doesn't really work.

      Please see below:

       

       

      This is working correctly. The calculated field is being sorted in descending order.

       

      However, if I select more that 1 year (FY 2015 & FY 2016) the sorting gets messed up:

       

      This is still sorting in descending order.

      However, the dimensions are not grouping properly. The years are out of order, as are the location names. I need years to be in order, and the location names to be grouped.

      This is what I want it to look like:

       

      Here i took off the sort calculation and you can see the data is grouped properly, though it is not being sorted.

       

      Does anyone know of a way to fix this issue?

        • 1. Re: Need help sorting blended data
          Yuriy Fal

          Hi Darren,

           

          This is Yuri (again), I've replied to your recent post here:

          Comparing Level of Detail Expressions Over Multiple Data Sources?

           

          Same dataset, same problems -- mainly about using data blend and the consequences.

          This one is as follows: one cannot use blended aggregate measures for dimension pill sorting.

          This is because of data blending to occur after an internal representation of a view is built (from dimensions).

           

          And the solution looks the same -- using a Table Calculation

          to build a Measure to sort upon, and RANK() to assign numbers.

          Since table calculations happen later in the Tableau operation pipeline,

          they could reference blended aggregations to get the desired output.

           

          As one could see, my solution uses the same table calculation

          as in the above -- but this time it is for sorting Marks on a view.

          And again, the Addressing is as important as the calc itself.

           

          Please find the attached.

           

          Yours,

          Yuri