Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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)

1 Solution

Accepted Solutions
sunny_talwar

May be this

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

View solution in original post

7 Replies
sunny_talwar

May be this

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

Anonymous
Not applicable
Author

Excellent, Thanks. Keep in touch

Anonymous
Not applicable
Author

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.

sunny_talwar

May be this

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

Anonymous
Not applicable
Author

Excellent. Thank you Sunny

Anonymous
Not applicable
Author

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.

sunny_talwar

May be this

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