cancel
Showing results for 
Search instead for 
Did you mean: 

Stacked column analytical card with sorting on total count?

0 Kudos

Hello,

(Context: NW750,HDB, UI5 v1.60 )

I have a Analytical Card with stacked column chart with two dimensions (CARRID,CONID) in CDS like this:

@OData.publish: true
@Analytics: { dataCategory: #FACT }
@UI.selectionVariant: [{ text: 'Default' }]
@UI.chart: [{ title: 'Carrier per Connection',
              chartType: #COLUMN_STACKED,
              dimensions: ['CarrierId','ConnectionId'],
              measures: ['SumCount'],
              dimensionAttributes: [{ dimension: 'CarrierId', role:#CATEGORY },
                                    { dimension: 'ConnectionId', role:#SERIES }],
              measureAttributes: [{ measure: 'SumCount', role:#AXIS_1 }]  }]

define view zzi_sflight as select from sflight
{
    key carrid as CarrierId,
    key connid as ConnectionId,
    key fldate as FightDate,
    @UI.dataPoint.description: 'Count'
    @DefaultAggregation: #SUM
    cast( 1 as abap.int8 ) as SumCount }

Which looks like this:

What I would like to do is to order the graph by the largest carrier to the smallest
Is it possible to order the columns by CarrierId total count, like below?

2nd problem is when the result set is limited then the graph will be "incorrect" or rather misleading:

Request URI is like this:

GET zzi_sflight?$skip=0&$top=10&$orderby=SumCount desc&$select=CarrierId,ConnectionId,SumCount

Since I am fetching top 10 ordered by the count, then it will give misleading comparison between e.g. UA and LH as they appear to have equal number of connections.

Any idea on how I can order this set by Carrier?

thanks,
Andri

My annotation looks like this:

<Annotations Target="Metadata.zzi_sflightType">
<Annotation Term="UI.PresentationVariant" Qualifier="test">
<Record Type="UI.PresentationVariantType">
<PropertyValue Property="Visualizations">
<Collection>
<AnnotationPath>@UI.Chart</AnnotationPath>
</Collection>
</PropertyValue>
<PropertyValue Property="SortOrder">
<Collection>
<Record Type="Common.SortOrderType">
<PropertyValue Property="Property" PropertyPath="SumCount"/>
<PropertyValue Property="Descending" Bool="true"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="UI.KPI">
<Record Type="UI.KPIType">
<PropertyValue Property="SelectionVariant" Path="@UI.SelectionVariant"/>
<PropertyValue Property="DataPoint" Path="@UI.DataPoint#SumCount"/>
<PropertyValue Property="Detail">
<Record Type="UI.KPIDetailType">
<PropertyValue Property="DefaultPresentationVariant" Path="@UI.PresentationVariant#test"/>
</Record>
</PropertyValue>
</Record>
</Annotation>
</Annotations>

View Entire Topic
Margot
Product and Topic Expert
Product and Topic Expert
0 Kudos

Regarding your first question: It is not possible to order the columns on the UI but you would need to do this on the backend.