Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with Calculated Dimension and Rank in Line Chart

Hi,

I am having trouble with using Rank in a  calculated Dimension when using a line chart.

My Straight Chart (QVStraightChart1)  has first expression:

YTD 2014          Sum({$<Year={"$(vMaxYear)"}, MonthID>}Volumes/Sum({$<Year={"$(vMaxYear)"}, MonthID>}Total(Volumes))

        2013           is {"$(vMaxYear-1)"}  etc

And has been restricted to show only 15 rows on the Presentation tab - all good here!

My Line Chart (QVLineChart) has the Calculated Dimension to show top 10 items only:

=IF(Aggr(Rank(Sum({$<Year={"$(vMaxYear)"}, MonthID>}Volumes/Sum({$<Year={"$(vMaxYear)"}, MonthID>} Total(Volumes)),4), Item) <=10, Item)

And the expression:

Sum({<MonthID>}Volumes)/Sum({<MonthID>}Total <Year>(Volumes))

However the figures are all wrong (QVLineChartFigures):

If I change the Calculated Dimension to <=50, the figures are then correct. Can anyone help?

If I use an expression of Sum({<MonthID>}Volumes/Sum({1<MonthID>} Total <Year> (Volumes)) the figures are all wrong.

Can anyone help?

2 Replies
JonnyPoole
Former Employee
Former Employee

A QVW would help. I'm sensing that while the expression is syntatically valid and giving you numbers, there could be an order of operations issue with the division or perhaps some null handling coming in .

If you can't share try testing it with just the numerator or the denominator

numerator rank

=IF(  Aggr(Rank(Sum({$<Year={"$(vMaxYear)"}, MonthID>}Volumes,4), Item) <=10, Item)

denominator rank

=IF(  Aggr(Rank(Sum({$<Year={"$(vMaxYear)"}, MonthID>} Total(Volumes)),4), Item) <=10, Item)


to see if ranking without the division yields the right values for top and bottom.


If those numbers are good / bad that will determine the next step.

Not applicable
Author

Hi Jonathan,

Is it possible to send you the qvw off the public domain?