Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
varenich
Contributor II
Contributor II

Sum distinct of previous records with condition

Hi,

Could you please advice how to make an expression or script to sum groupped distinct values with additional condition?

In each row of a segment I need to sum distinct (UniqueID) values (CRITICAL) from the row to begginning of a segment with additional check if UniqueIDEnd (of each previous record)  >[Check time] (of the current record)


theproblem.pngTried tons of ways, broke my head but  without success. Please help.

 

DevOps metrics
Labels (3)
1 Solution

Accepted Solutions
mrybalko
Creator II
Creator II

I think that is it

Critical.JPG

View solution in original post

10 Replies
mrybalko
Creator II
Creator II

Hello

Could you explain segmentation conditions? What is segment?

varenich
Contributor II
Contributor II
Author

Just Date (left column)

DevOps metrics
mrybalko
Creator II
Creator II

Ok. For every row we need to calculate the cumulative sum(critical) for distinct UniqueIDs with additional time check, don't we?

What value should be displayed in rows with duplicate UniqueID: just repeat the previous value, null or exclude this row?

sunny_talwar

What is the significance of the red line going across? Is that saying that 511 will only be summed for rows above the red line? If so, why? Also, it would help if you can share the expected output in an Excel file.

varenich
Contributor II
Contributor II
Author

theproblem2.png

DevOps metrics
varenich
Contributor II
Contributor II
Author

Please check screenshot below

DevOps metrics
varenich
Contributor II
Contributor II
Author

Tried "As Of" tables, but it hangs up my computer. I think its because I have 150 000 * 20 unique records per day.

DevOps metrics
mrybalko
Creator II
Creator II

I think that is it

Critical.JPG

varenich
Contributor II
Contributor II
Author

Wow! How did you do it?!

Let me a minuite to check the script, please

DevOps metrics