Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
jeevays7
Partner - Creator III
Partner - Creator III

Pivot table before/after function with two dimensions.

Hi all,

I have a pivot table with data as below,

   

Date25-Nov-201625-Nov-201625-Nov-201602-Dec-201602-Dec-201602-Dec-2016
NameMGT FEESPIFPERF FEESMGT FEESPIFPERF FEES
MENA10.0020.0030.005.0010.0020.00
Raj1.003.004.005.003.004.00
Tamil4.006.006.001.002.002.00

Now i want the result like below table,

In below table i take the (25-NOV-2016) MGT FEES and subtract with next day(02-Dec-2016) MGT FEES value.

so like that all date values subtracted with previousday values with coressponding Names.

Date25-Nov-201625-Nov-201625-Nov-201602-Dec-201602-Dec-201602-Dec-2016
NameMGT FEESPIFPERF FEESMGT FEESPIFPERF FEES
MENA5.0010.0010.005.0010.0020.00
Raj-4.000.000.005.003.004.00
Tamil3.004.004.001.002.002.00

How to achieve this in pivot table?

15 Replies
sunny_talwar

Try this:

=Aggr(RangeSum(Sum(Value), -Below(Sum(Value))), Name, Desc, Date)

Capture.PNG

swuehl
MVP
MVP

Try

=Only(

     Aggr(

           Sum(Value) - Below( Sum(Value) )

     ,NAME, DESC, DATE)

)

If your DATE field values are not in chronological load order, use

The sortable Aggr function is finally here!

jeevays7
Partner - Creator III
Partner - Creator III
Author

Hi sunny,

the above yours exp is not working

sunny_talwar

It's not working in your actual scenario or the output from the sample is not what you want? As Stefan pointed, for this to work you need the date field to be sorted in ascending order via the load script.... If it isn't then you can use Sorting through Aggr(), but for that you would need to have at least QV12. Do you have QV12? If yes, then you can try this:

=Aggr(RangeSum(Sum(Value), -Below(Sum(Value))), Name, Desc, (Date, (NUMERIC)))

jeevays7
Partner - Creator III
Partner - Creator III
Author

Hi Stefan,

Your expression is not working for me.

jeevays7
Partner - Creator III
Partner - Creator III
Author

Thank you sunny and stefan for all your reply's.

Now it's working.