Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
andre_ficken
Partner - Creator
Partner - Creator

sum duplicate values

Hi, I have the following thing I am trying to do. I need a sum of all shifts planned for week 52 of 2019. In that week of monday to sunday there are 3 sunday rosters (sunday and both christmasdays) the sunday has 63 shifts to fill in where the normal wednesday and thursday have 87. 

for that week I have for each day, monday thru friday, the following totals over 3 day parts (day,evening,night) per day:
mon:83.5, tue:85.5, wed:63, thu:63, fri:93, sat:72, sun:63  this normally sums up to 523, but because of the 3 duplicate days on sunday rosters a Sum(shifts) returns the correct number per day, but the total per daypart it sums up to 397 missing the 126 shifts of the wed and thu sunday roster.

It does not seem to be adding up the 3 sunday shifts that are linked correctly to the normal weekdays. Any ideas how to solve this are welcome...

 

1 Reply
lorenzoconforti
Specialist II
Specialist II

I believe this will fix your calculation:

=sum(aggr(sum(Shifts), Date))

 

The real problem is how you've set up your data structure; you probably have two tables (one with the calendar days and the other with the respective shifts linked by roster day). You have three days in the first table (Sunday, the 25th and the 26th) that are linked to the same three entries in the second table (Sunday-Day, Sunday-Evening and Sunday-Night) so when you do your sum(shifts) QlikView correctly uses Sundays only once. The real solution is to bring your day part into your main table