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: 
dana
Creator III
Creator III

Aggregating duplicate values over periods

Hi,

This is an updated post about an issue with dealing with duplicate values, since I couldn't edit the original one.

I have simplified my previous post..
I created 2 tables with monthly data:

 

dana_0-1757482689207.png

FirstInfected_Monthly table has the fields Year-Month, Disease, Department,

Hospitalization_Monthly has Patients count in a department (all of them, not only the sick ones)

dana_1-1757482996937.png

In the UI,  when a table includes the field Year-Month and a year is selected, the Patients count display as expected: the same number in a department, regardless of the disease:

dana_2-1757483239892.png

But when the Year-Month is removed, instead of showing the total yearly number for each department (383),

the value is aggregated by Disease:

dana_3-1757483490360.png

I have tried various AGGR and Total options, but nothing worked..
I attach sample data, hoping for some help..

Thanks in advance!

 

 

 

 

 

 

 

 

 

 

Labels (2)
1 Solution

Accepted Solutions
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Sorry, my bad. What do you get if you just do Sum(Total  Patient)? is that what you expect? Doing it with "Total" will depend on what other dimensions you want this measure to work with. in your chart object.

Lech_Miszkiewicz_2-1757490813999.png

 

 

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.

View solution in original post

4 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @dana 

As far as I can tell number of patients is correct. The total adds up to 383 in each case. 

We dont really see granularity of your key field used to link both tables but I assume it is likely including month and department so taking that into consideration we can see that it is possible that for some months you may not have a record with particular disease. 

If you want to have total of patients regardless of disease then your expression may need to look like:

Sum(Total <Disease> Patient)

 

cheers

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
dana
Creator III
Creator III
Author

Hi Lech,

I did try using TOTAL, but it didn't work as expected:

dana_0-1757486011507.png

Thanks...

 

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Sorry, my bad. What do you get if you just do Sum(Total  Patient)? is that what you expect? Doing it with "Total" will depend on what other dimensions you want this measure to work with. in your chart object.

Lech_Miszkiewicz_2-1757490813999.png

 

 

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
dana
Creator III
Creator III
Author

Hi Lech,

Yes! you nailed it!

I had to use total by Department. Since Total Patients only will be calculated for all the departments..

Thank you for your kind help!

dana_1-1757492275069.png