Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
SDT
Contributor III
Contributor III

Calculate "new" business by customer and product for each sales person

To oversimplify the model, lets assume I have the following fields:

Invoice, InvoiceDate, SalesPerson, Customer, Product, Revenue

along with a fiscal year calendar linked to the InvoiceDate.

I need to aggregate "new" sales to the sales person level. New is defined as the customer did not buy that product last fiscal year and they are buying it this fiscal year.

I expect I need to use sum(aggr(${<>}sum(Revenue), Customer, Product) and I know I am missing a lot there. I don't know if I can accomplish the comparison against prior year in set analysis or if I need to use IF().

Any suggestions on how to achieve this?

Thank you!

1 Reply
SDT
Contributor III
Contributor III
Author

Might have it figured out using a cartesian if.

sum(aggr(((sum({$<FY={'FY20'}>} Revenue)=0) or isnull(sum({$<FY={'FY20'}>} Revenue)))

              *(-1)*sum({$<FY={'FY21'}>} Revenue), Customer, Product))

It seems to work correctly when I use Customer and Product as dimensions and also when I roll up to salesperson instead.