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: 
Anonymous
Not applicable

Expressions for Pivots (avoiding double counting)

Here is example of the data I am working with. There are two challenges with my pivot of this data.
1) The same deal (UMASS appears in multiple distinct campaigns)
2) Within the same campaign UMASS appears twice.
   
Name of Marketing Campaign
Sales repName of DealDollars from each deal
Program1John UMASS$1,000
Program1Drake BW$3,500
Program1JimTS$1,500
Program1BlakeUMASS$1,000
Program2IvanUMASS$1,000
Program2SofiaBBC$1,000 
Despite the two constraints above, I want the output of the pivot to be as shown below (i.e. within program 1, I want UMASS $ to be counted once in the pivot AND I want to allocate the UMASS totaL $ deal between 2 campaigns equally (500 for program 1 and 500 for program 2).
Output I want:
Name of Marketing Campaign total dollars from deals
Program15500
Program2
1500
Grand Total7000
1 Reply
sunny_talwar

Try this

Sum(Aggr(Sum(DISTINCT [Dollars from each deal])/Count(DISTINCT TOTAL <[Name of Deal]> [Name of Marketing Campaign]), [Name of Marketing Campaign], [Name of Deal]))