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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get a % Total colum to calculate based on expression?

New to QlikView and community....I am trying to compare Year over Year changes for our renewal customers. I have four columns: sub year, sub year - 1, yoy change, and % change. The first 3 columns are coming back with the correct results as I have the column properties for Total to sum rows. However, this does not work for the Total on % change column as I want the % change to reflect the sum of rows for yoy change/total sum of rows for Sub Year-1. I have the expressions listed below for each column. The % YOY change Total Mode is set on the expression but is returning the % change for the whole data set not the expression. It works on the individual rows.

Selected Year: Total Mode set to Sum of Rows

if(sum({$<[Sub Year]={$(=max([Sub Year]-1))}>} [Sub Amt]) > 0 ,sum({$<[Sub Year]={$(=max([Sub Year]))}>} [Sub Amt]) ,0)

Selected Year-1:Total Mode set to Sum of Rows

if(sum({$<[Sub Year]={$(=max([Sub Year]))}>} [Sub Amt])>0,sum({$<[Sub Year]={$(=max([Sub Year]-1))}>} [Sub Amt]),0)

YOY Change:Total Mode set to Sum of Rows

if(sum({$<[Sub Year]={$(=max([Sub Year]-1))}>} [Sub Amt]) > 0 ,sum({$<[Sub Year]={$(=max([Sub Year]))}>} [Sub Amt]) ,0)
-
if
(sum({$<[Sub Year]={$(=max([Sub Year]))}>} [Sub Amt])>0,sum({$<[Sub Year]={$(=max([Sub Year]-1))}>} [Sub Amt]),0)

    

% YOY Change:Total Mode set to Expressoin

(if(sum({$<[Sub Year]={$(=max([Sub Year]-1))}>} [Sub Amt]) > 0 ,sum({$<[Sub Year]={$(=max([Sub Year]))}>} [Sub Amt]) ,0)
-
if
(sum({$<[Sub Year]={$(=max([Sub Year]))}>} [Sub Amt])>0,sum({$<[Sub Year]={$(=max([Sub Year]-1))}>} [Sub Amt]),0))

/
if
(sum({$<[Sub Year]={$(=max([Sub Year]))}>} [Sub Amt])>0,sum({$<[Sub Year]={$(=max([Sub Year]-1))}>} [Sub Amt]),0)

    

Please let me know if more information is needed.

0 Replies