# Qlik Sense App Development

Highlighted Partner

## Top N chart is showing N-1 value

Hello Everyone,

I am trying to create Top N chart with two dimensions and one measure.

My dimensions and Measure are as follow's:

• Dimension1: aggr(if(rank(sum(Sales))<=vTopRank,Customer),Customer)
• Dimension2: [Invoice Date]
• Measure : sum(Sales)
• vTopRank is variable

I'm trying to vary vTopRank using slider, but whenever I try to do so. I'm getting result by Top N-1.

To elaborate this. If I want Top 10 records it show's me Top 9 records.

Is there anything I am doing wrong with my Dimension1 or somewhere else?

Please let me know if you have any clue on this.

Labels (3)

• ### Top N value

1 Solution

Accepted Solutions Partner

## Re: Top N chart is showing N-1 value

Hello Everyone,

I tried almost every possible solution available on community to solve this issue by creating different different calculation dimension and measure.

But unfortunately I didn't get anything which can solve this issue.

So I tweaked my first dimension in such a way that it will solve this issue automatically.

Here is my calculated dimension.

"IF(MATCH(\$(=COUNT(IF(AGGR(Rank(sum(Sales))<=vTopRank,Customer),Customer))),vTopRank),
IF(AGGR(Rank(sum(Sales))<=vTopRank,Customer),Customer),
IF(AGGR(Rank(sum(Sales))<=vTopRank
- \$(=COUNT(IF(AGGR(Rank(sum(Sales))<=vTopRank,Customer),Customer))-vTopRank),
Customer),Customer)
)"

Basically here I am doing plus or minus according to given result by old calculated dimension.

This solved my issue but I am still confused about, why old calculated dimension was not giving correct answer?

Please do let me know if you ever faced such situation and found cause of it.

--

Regards,

Devendra Babar

3 Replies Partner

## Re: Top N chart is showing N-1 value

turn of the other values? Partner

## Re: Top N chart is showing N-1 value

But I have already unchecked "Show Others" option from both Dimensions.

--
Thanks,
Devendra Babar Partner

## Re: Top N chart is showing N-1 value

Hello Everyone,

I tried almost every possible solution available on community to solve this issue by creating different different calculation dimension and measure.

But unfortunately I didn't get anything which can solve this issue.

So I tweaked my first dimension in such a way that it will solve this issue automatically.

Here is my calculated dimension.

"IF(MATCH(\$(=COUNT(IF(AGGR(Rank(sum(Sales))<=vTopRank,Customer),Customer))),vTopRank),
IF(AGGR(Rank(sum(Sales))<=vTopRank,Customer),Customer),
IF(AGGR(Rank(sum(Sales))<=vTopRank
- \$(=COUNT(IF(AGGR(Rank(sum(Sales))<=vTopRank,Customer),Customer))-vTopRank),
Customer),Customer)
)"

Basically here I am doing plus or minus according to given result by old calculated dimension.

This solved my issue but I am still confused about, why old calculated dimension was not giving correct answer?

Please do let me know if you ever faced such situation and found cause of it.

--

Regards,

Devendra Babar