Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
waleeed_mahmood
Creator
Creator

Sum Distinct Values in Table Total

Hello,

I have a question that i cant seem to solve.

I have the following table:

Region CoverageSales EmployeeTargets
Eastuser11,350,000
Eastuser21,350,000
Eastuser31,350,000
Eastuser41,350,000
Total 5,400,000

 

Since, the region is the same and the targets are the same, can we have the total to be 1,350,000 since all targets in the regions are the same?

Thank you in advance.

Waleed

23 Replies
waleeed_mahmood
Creator
Creator
Author

Hi Sunny,

While your expression works for example provided by Thiago, it doesn't work for my Target numbers. My Targets are attached to a Master Calendar so they can be filtered for months and show YTD numbers and when we do Distinct Targets it uses the distinct values from all those daily targets. Would you happen to have an expression where the distinction is applied after the summation of targets.

Please let me know if this makes sense or i can try to word it better.

Thank you.

sunny_talwar

May be try this

If([Region Coverage] = 'East',
    Aggr(NODISTINCT Sum(DISTINCT Aggr(Sum(Target), [Region Coverage], [User])), [Region Coverage])),
    Sum(Target)
)
waleeed_mahmood
Creator
Creator
Author

Hi Sunny,

I was able to get it to work by taking out the first aggr.

Thank you @Thiago_Justen_  and @sunny_talwar  for all your help.

Thanks

sunny_talwar

Awesome, I am glad it finally worked.