Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Odla88
Contributor
Contributor

HOW TO COMPARE CURRENT AND NEXT PERIOD IN A PIVOT TABLE

Hi all,

I have an issue related a calculation of a formula between different years.

I have a pivot table that has as row dimension “outlet type”, as column dimension “year” and as measure sum(value).

My aim is to check if sum(value) related to dealers of each year + sum(value) related to opened delaers of next year - sum(value) related to closed delaers of next year = sum(value) related to dealers of next year. I want to show this check coloring the cells as sowed in the figure below.

I need to find a solution WITHOUT editing back-end script, and the solution must works even if I will add more years in the “year” dimension.

So this is my current situation

Odla88_0-1653668022563.png

 

and this is what I need to obtain

Odla88_1-1653668022604.png

I also attach a qvf. 

Thank you in advance to all!

 

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Use before() 

https://help.qlik.com/en-US/sense/February2022/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/Inter...

 

Also use 3 measures one for each dealer type and one dimension i.e. Year 

Example syntax

=If(

(before(count({<Dealertype={'Dealers'}>}something))+count({<Dealertype={'OpenedDealers'}>}something))-count({<Dealertype={'ClosedDealers'}>}something))

)=count({<Dealertype={'Dealers'}>}something), green(),red() )

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

1 Reply
vinieme12
Champion III
Champion III

Use before() 

https://help.qlik.com/en-US/sense/February2022/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/Inter...

 

Also use 3 measures one for each dealer type and one dimension i.e. Year 

Example syntax

=If(

(before(count({<Dealertype={'Dealers'}>}something))+count({<Dealertype={'OpenedDealers'}>}something))-count({<Dealertype={'ClosedDealers'}>}something))

)=count({<Dealertype={'Dealers'}>}something), green(),red() )

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.