7 Replies Latest reply: Feb 6, 2018 3:12 PM by Sunny Talwar

# Set Analysis, or I think so

Hi. I work with Qlik Sense. I need to get a list of customers who bought an X product.

That X product is the most sold in the current year.

To obtain it, I used the function "firstsortedvalue (ProductName, -Ventas)" that returns the product with the highest sales value.

It shows it in a KPI and it is with respect to the selected year, if a year has not been selected then it obtains by default the one of the most recent year.

I already verified that  and in effect I obtain the product with the most sales (money, not volume by quantity).

But now I have to show a table with exclusively the customers that bought that product and their purchase amount.

I have as Dimension: Clients

I have as Measure: sum (sales)

• ###### Re: Set Analysis, or I think so

May be this

Sum({<ProductName = {"\$(=FirstSortedValue(ProductName, -Ventas))"}>}sales)

• ###### Re: Set Analysis, or I think so

Excellent, Thanks. Keep in touch

• ###### Re: Set Analysis, or I think so

I would like them to be seen  from the most recent year. Because, by default it shows all the costumers who have bought during all these years, from 2004 to 2009.

• ###### Re: Set Analysis, or I think so

May be this

Sum({<ProductName = {"\$(=FirstSortedValue(ProductName, -Ventas))"}, Year = {"\$(=Max(Year))"}>}sales)

• ###### Re: Set Analysis, or I think so

Excellent. Thank you Sunny

• ###### Re: Set Analysis, or I think so

I will have to do that. I'm trying do a comparison of products, where I need to find my most sold product that wasn't sell the previous year.

• ###### Re: Set Analysis, or I think so

May be this

Sum({<ProductName = {"\$(=FirstSortedValue({<ProductName = e({<Year = {\$(=Max(Year) - 1)}>})>}ProductName, -Ventas))"}, Year = {"\$(=Max(Year))"}>}sales)