SAP Knowledge Base Article - Public

3211919 - Stacked Bar Chart Legend sorted in different order in SAP Analytics Cloud (SAC)

Symptom

  • Legend sorted differently in different Stacked Bar Chart.
  • Multiple Stacked Bar Chart based on the same Model sort the Chart Legend differently in SAP Analytics Cloud.
       
        
  • Note: Images and data in this SAP Knowledge Base Article is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

Environment

  • SAP Analytics Cloud

Reproducing the Issue

  1.  In SAP Analytics Cloud, create a Story.
  2. Add a Stacked Bar Chart based on one Model.
  3. Sort the Legend on the Measure from the Highest to the Lowest.
  4. Add a second Stacked Bar Chart based on the same Model, and add a Filter.
  5. Sort the Legend on the Measure from the Highest to the Lowest. ( The same sort as the first chart )
  6. Notice the Chart Legend list the items in different order.
       
    Stacked Bar Chart - Legend Sort Order.png

Cause

  • In brief, the Chart Legend is sorted in different order on the different charts because the data set is different.
         
  • In more details: When sorting a Stacked Bar Chart on a Measure in decending order, the items in the Chart Legend will be listed from items that have the summary with the lowest values, to the items with the summary of the highest values, based on the first stacked bar of the chart. When the data set is different, and the summaries values for each items is different, then the Chart Legend of the Stracked Bar Chart will be sorted in different order.
         
  • For example: In the screenshot of 2 Stacked Bar Charts in the section "Reproducing the Issue", the Chart Legend list the items: Blue and White in different order because the chart on the left, the first bar of the stacked bar chart shows the following on the first Stacked Bar:

    - Blue   : 10
    - White : 45
     
    And the legend displays the items with the lowest summary values, to the higher summary value, which is:

    - Blue  
    - White
      
    And the chart on the right side, the first bar of the stacked bar chart, are:

    - White : 18
    - Blue   : 35

    The legend displays the items with the lowest summary values, to the higher summary value, which is:

    - White
    - Blue
     
    And this is why the Legend on both Stacked Bar Chart shows in different order.

      
  • In Summary: Depending on the sort order selected for the Measure on the Stacked Bar Charts, the items in the Chart Legend will be listed as followed:

    Measure Sorted on the Chart Legend will sort the items based on the first stacked bar of the chart from
    Highest to Lowest (Descending) Items with the lowest value to the items with the highest values
    Lowest to Highest (Ascending) Items with the highest value to the items with the lowest values

Resolution

  • There are no option in SAP Analytics Cloud to sort the Chart Legend independently of how the Chart is sorted.

See Also

Keywords

SAC , KBA , LOD-ANA-DES , Story Design & Visualizations , Problem

Product

SAP Analytics Cloud 1.0