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: 
ZoeM
Specialist
Specialist

Sum a field based on Distinct other field

Hello Community.

I need to find the Sum of one field after I find the Distinct Count of another field.  I have my Count Set Analysis as follows:

=Count({$<Stage={'Final'},[Date Type]={'VPP Dates'},Scale={'>50'},Track={'Y'},[#of Days Post VPP]={'>=0'}>}DISTINCT Program)

i.e. I am counting the distinct programs that meet this set of criteria. After counting them, I now need to find the sum of [#of Days Post VPP], how can I incorporate that into a Sum of Count expression?

 

any help rendered will be truly appreciated. 

Labels (3)
1 Reply
Anil_Babu_Samineni

Perhaps this?

=Sum({<[#of Days Post VPP]={'>=0'}>} Aggr(Count({$<Stage={'Final'},[Date Type]={'VPP Dates'},Scale={'>50'},Track={'Y'},[#of Days Post VPP]={'>=0'}>}DISTINCT Program), Dimension))

Or

=Sum({<[#of Days Post VPP]={'>=0'}, Stage={'Final'},[Date Type]={'VPP Dates'},Scale={'>50'},Track={'Y'}>} Aggr(Count({$<Stage={'Final'},[Date Type]={'VPP Dates'},Scale={'>50'},Track={'Y'},[#of Days Post VPP]={'>=0'}>}DISTINCT Program), Dimension))

Best Anil, 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