# QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for
Did you mean:
Highlighted
Partner

## how to get first nth date in pivot table?

HI ALL,

How I'll get the first nth date in Pivot table.

For example I have below sample date:

Date                    Sales

01-01-2014          100

02-01-2014          101

03-01-2014          100

04-01-2014          100

---------------          ------    and so on.

Now I want to display only first 3 date and their respective sales in pivot table.

1 Solution

Accepted Solutions
Highlighted
MVP

## Re: how to get first nth date in pivot table?

You can use the following as a calculated dimension (also see attached example.qvw):

 =aggr(if(rank(Date)-count(total distinct Date)>-3,Date),Date)
7 Replies
Highlighted
Not applicable

## Re: how to get first nth date in pivot table?

I would say that you need to use a Set Analysis:

sum ({<Date = {"< xxxx"}> } Sales)

or if the date is related to a key

sum({<Date_Key ={" <= 3 "}> } Sales)

Fabrice

Highlighted
Not applicable

## Re: how to get first nth date in pivot table?

Hi

or use calculated dimension to fix the set of dates you want

Chris

Highlighted
MVP

## Re: how to get first nth date in pivot table?

You can use the following as a calculated dimension (also see attached example.qvw):

 =aggr(if(rank(Date)-count(total distinct Date)>-3,Date),Date)
Highlighted
Not applicable

## Re: how to get first nth date in pivot table?

Excellent

Forgot that possibility !!

Fabrice

Highlighted
Partner

## Re: how to get first nth date in pivot table?

Hi Fabrice and Chris

Thanks for reply... I tried calculated dimension also but  how I apply Rank function in date dimension.

Highlighted
MVP

## Re: how to get first nth date in pivot table?

Right like in my post above...

Highlighted
Partner

## Re: how to get first nth date in pivot table?

thanks Nicole......its working fine...