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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to calculate % increase of preview value

Hi,

I was trying to calculate the percentage increase of previous value.

for example:

aggr(Sum({<Year = {'$(=Max(Year))'}>}Sales),Year,Country)  // Latest year

aggr(Sum({<Year = {'$(=Max(Year)-1)'}>}Sales),Year,Country)  // previous year

Differences of them :

Difference = aggr(Sum({<Year = {'$(=Max(Year))'}>}Sales),Year,Country)-aggr(Sum({<Year = {'$(=Max(Year)-1)'}>}Sales),Year,Country)

What i want is to calculate is the% increase/decrease of previous year

Change of % =  Difference / Previous year * 100

 

How this can be done in set expression syntax.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

What is the context of your expression? Where do you use it / What are dimensions used etc.?

In general, this should calculate your percentage change:

= num(

Sum({<Year = {'$(=Max(Year))'}>}Sales) / Sum({<Year = {'$(=Max(Year)-1)'}>}Sales) -1

,'#.00%')

View solution in original post

3 Replies
swuehl
MVP
MVP

What is the context of your expression? Where do you use it / What are dimensions used etc.?

In general, this should calculate your percentage change:

= num(

Sum({<Year = {'$(=Max(Year))'}>}Sales) / Sum({<Year = {'$(=Max(Year)-1)'}>}Sales) -1

,'#.00%')

Not applicable
Author

The concept is to calculate the % of change in sales per country  in years.

Dimension is Country

Not applicable
Author

Thanks.

This expression calculates only the firs value.

= num(

Sum({<Year = {'$(=Max(Year))'}>}Sales) / Sum({<Year = {'$(=Max(Year)-1)'}>}Sales) -1

,'#.00%')