Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

I want to sort a dimmension in a chart by the value is calculated

Good evening,

I have a dimension (Area_Desc3) which contains countries and I have an expression as it follows:

(
Sum({<Año={$(vaño_cierre)}, Mes={$(vMes)}, Category_ID={'ACTUAL'}, Division_Desc>}
if(isnull($(=$(vDivision_Siguiente))),
$(Magnitudes Esenciales)
)
)
+
if(Division_ID='ELIM',Sum({<Año={$(vaño_cierre)},Mes={$(vMes)},Category_ID={'ACTUAL'}>} total $(Eliminaciones Intercompañía)),0)
)

/
if(dimensionality()=1 or Dimensionality()=2,Sum(Aggr(
Sum({<Año={$(vaño_cierre)}, Mes={$(vMes)}, Category_ID={'ACTUAL'},Area_Desc3>}
if(isnull($(=$(vDivision_Siguiente))),
$(Magnitudes Esenciales)
)
)
+
if(Division_ID='ELIM',Sum({<Año={$(vaño_cierre)},Mes={$(vMes)},Category_ID={'ACTUAL'},[Nac/Int]>} total $(Eliminaciones Intercompañía)),0)
,
Area_Desc3,Division_Desc)),

top(Sum(Aggr(
Sum({<Año={$(vaño_cierre)}, Mes={$(vMes)}, Category_ID={'ACTUAL'}>}
if(isnull($(=$(vDivision_Siguiente))),
$(Magnitudes Esenciales)
)
)
+
if(Division_ID='ELIM',Sum({<Año={$(vaño_cierre)},Mes={$(vMes)},Category_ID={'ACTUAL'}>} total $(Eliminaciones Intercompañía)),0)
,
Division_Desc))))

Additionally, I have a dimension that contains the divisions, so I have 2 bars, one per each division and those are composed by the stacked % of the expression per country.

I have a limit on the dimensión Area_Desc3 to limit it to the top 7 (which is a requirement), and the rest is going to 'Other's'. It is not sorting well the data so I need to order Area_Desc3 by value.

I have already tried to sort it with the expression and by value but I still see the same chart

Thank you very much

0 Replies