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: 
chris_92
Contributor
Contributor

Dividing Set Expressions

Hi all:

I've gone through quite a few forum posts on this, and I'm still not able to make this work as intended. I'm looking to construct a line chart that shows growth rates for multiple zip codes as it relates to a base year, e.g. 2020 is my base year, I want to see the growth rate from 2020 to 2021 and from 2020 to 2022. Per the example I have attached, I have a type, year, zip code, and volume field that I've done in an inline load (for example purposes). My expression for the chart is as follows: 

(sum({<Type = {'1'}>} Volume)
/
sum({<Type = {'1'},Year={'2020'}>} Volume)
)-1

The dimensions used in the graph are year and zip code. I've tried creating a separate set of years (i.e. using a separate inline load that just contains the years I want to analyze) to use as the table dimension, using "sum(total" in the numerator or denominator of that division, and other solutions provided previously on the forums, but have had no luck thus far. Ideally, the graph should have a line for each zip code, with percentage on the y-axis and year on the x-axis, with the values of the points as follows, per the data in the example attached:

 20212022
2254620%40%
2254725%50%

 

Any help would be greatly appreciated.

Thank you very much!

Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

Try this

Sum({<Type = {'1'}>} Volume)/Sum(TOTAL <Zip> {<Type = {'1'},Year={'2020'}>} Volume)-1

View solution in original post

2 Replies
sunny_talwar

Try this

Sum({<Type = {'1'}>} Volume)/Sum(TOTAL <Zip> {<Type = {'1'},Year={'2020'}>} Volume)-1
chris_92
Contributor
Contributor
Author

That worked perfectly, thank you so much!