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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
fen_one
Contributor
Contributor

Sum value for two distinct dimensions

Hi,

I have a table with two dimensions; Ticket_id and Question_id, and a value; Rating. I want to, in set analysis, sum the Rating. The problem I have is that there can be multiple rows with the same Ticket_id, Question_id and Rating, but I only want to sum Rating for distinct Ticket_id and Type. This is because every row has a different timestamp and each row is counted as a separate support issue.

TableTable

So for the above example the results should be a sum of 14 and a count of 4.

I have tried with the Aggr() function (and it gives me the correct result) but since I need to be able to select a date period and it changes the sum depending on what dates I choose I can't use that. The data is presented in a table with Date as the main dimension shown in weeks/months.

For the count I'm using the following which works, is there a way to do this for sum? 

 

count({<Question_id-={''},Rating-={''}>}distinct Ticket_id & Question_id)

 

 

Labels (1)
1 Reply
BrunPierre
Partner - Master II
Partner - Master II

Sum(Aggr(Sum(DISTINCT{<IDs={"=Count({<Question_id-={''},Rating-={''}>}DISTINCT Ticket_id & Question_id)>0"}>} Rating), Date , Question_id, Ticket_id))