Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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?

1 Solution

Accepted Solutions
sunny_talwar

Try this:

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

Capture.PNG

View solution in original post

15 Replies
swuehl
MVP
MVP

MGT FEES is an expression, right?

Date is your pivoted dimension and Name dimension shows values like MENA, Raj, Tamil, right?

Have you tried something like

= [YourExpression for MGT FEES] - After( [YourExpression for MGT FEES]  )

Or use Before(), not sure what you want to calculate here.

Replace [YourExpression for MGT FEES] with your expression used, e.g. Sum(Sales)

sunny_talwar

I think be better to use RangeSum() so that the next day value doesn't turn null here:

RangeSum([YourExpression for MGT FEES], -After( [YourExpression for MGT FEES]))

jeevays7
Partner - Creator III
Partner - Creator III
Author

Hi Sunny and Stefan,

here MGT FEES,PIF and PERF FEES also a dimension(Desc) values.

  

Date25-Nov-2016
NameDescMGT FEE
MENA 10.00
RAJ 1.00
sunny_talwar

What is your expression here?

sunny_talwar

I think this should still work for you:

RangeSum(ExpressionHere, -After(ExpressionHere))

Replace ExpressionHere with whatever your expression is

jeevays7
Partner - Creator III
Partner - Creator III
Author

just sum(values) is my expression

sunny_talwar

Can you try this:

RangeSum(Sum(values), -After(Sum(values)))

jeevays7
Partner - Creator III
Partner - Creator III
Author

Hi sunny,

Name,Date,Desc is my dimensions and sum(Value) is my expression.

Name dimension is being left side and Date, Desc dimension should be top of the pivot table

jeevays7
Partner - Creator III
Partner - Creator III
Author

The pivot table looking like this without design.

  

Date                                     25-Nov-2016             02-Dec-2016 
NameDesc      MGT 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