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: 
Karahs
Partner - Creator
Partner - Creator

Variance between two Months

Hello everyone,

               I have a pivot table in which there are month columns ie. April-March.I want to calculate variance between the two selected months.

Eg. If i select April and March i should be getting the vairance between them in the next column called variance in a pivot table.

Thanks & Regards,

Kshitija

12 Replies
sunny_talwar

Do you have a sample you can provide with the expected output?

Karahs
Partner - Creator
Partner - Creator
Author

Hello Sunny,

          Cant uplaod the data but attaching an image for more clear understanding.

Qlik.png

Now i have selected Jan and Feb so i got the variance as shown in image,in short based on selection of two months i sould get the variance.

My dimension is Month and

Expression is Sum(Cost Amount)

Thanks

Karahs
Partner - Creator
Partner - Creator
Author

I used this formula:

Sum(Amount) - Above(Sum(Amount))

But it only work when data is present in both months, but when i select Jan and Feb

Jan has some value and feb is null den it gives me null only.

sunny_talwar

How about this:

RangeSum(Sum(Amount), -Above(Sum(Amount)))

Karahs
Partner - Creator
Partner - Creator
Author

Not working Sunny, Still getting null values

antoniotiman
Master III
Master III

Use Alt() function

Like

Alt(Sum(Amount),0)

Karahs
Partner - Creator
Partner - Creator
Author

qlikk.png

In the expected output i am getting 265 where i should get -265

brunobertels
Master
Master

Hi

if you use a pivot table in qlik sense dont use above function but before() :

mesure variance

sum(amount) - before(sum(amount))

hope it helps

bruno

Karahs
Partner - Creator
Partner - Creator
Author

Hey Bruno,

Thanks for the reply but it doesnt work