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

How to get total difference in straight table against two values in a dimension?

I have a bunch of metrics (left in image below) that I create as expressions and one date dimension (current and previous week) which limits only two dates. How do I get a total/difference column at the end to calculate the difference between the two weeks which is based on a dimension. Column WW is what I want.Untitled.png



13 Replies
Anonymous
Not applicable
Author

Hi John,

I tried your example and it works on simple sum.  However, I have percentage calculation and I want to do the difference between the two week percentage.  It doesn't work when I use the sum and sign from your example .

johnw
Champion III
Champion III

OK, back to the previous idea. I've added a Weeks Back field, and used this expression. This might not be exactly what you want, but the idea is to check the column to decide which calculation to perform.

if(Column='W/W',num(sum({<[Weeks Back]={1}>} CSAT)/sum({<[Weeks Back]={2}>} CSAT)-1,'+#,##0%'),num(sum(CSAT),'#,##0'))

Anonymous
Not applicable
Author

Hi John,


You are getting close.  However, I want the % calculate for each week and the do the different on the two weeks. See image and Qlikview file where I added another dimension to the raw data.Untitled.png

johnw
Champion III
Champion III

if(Column='W/W'
,sum({<SL={'SL1'},[Weeks Back]={1}>} CSAT)/sum({<[Weeks Back]={1}>} CSAT)
-sum({<SL={'SL1'},[Weeks Back]={2}>} CSAT)/sum({<[Weeks Back]={2}>} CSAT)
,sum({<SL={'SL1'}>} CSAT)/sum(CSAT
))

Capture.PNG