Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
lost_rabbit
Contributor III
Contributor III

Find Total price of top 5 customers in a certain time frame

I am trying to find the total price of the Top 5 customers for a date range greater than 202314

This formula works (one specific week 202314)

= sum({<Customer= {"=Rank(Sum({<ExpYrWk ={'202314'}>} Price)) <=5"} >}Price)

But this does not  (weeks greater than 202314)

= sum({<Customer= {"=Rank(Sum({<ExpYrWk ={">202314"}>} Price)) <=5"} >}Price)

I guess it is not working because of using double quotes here. But I have to use it to perform search operation (>202314). Not sure how to do this.

 

Thanks in advance 

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

@lost_rabbit  you need to escape double quotes in inner set as you already used it in outer set like below

= sum({<Customer= {"=Rank(Sum({<ExpYrWk ={"">202314""}>} Price)) <=5"} >}Price)

View solution in original post

8 Replies
Chanty4u
MVP
MVP

Try this 

= sum({<Customer= {"=Rank(Sum({<ExpYrWk ={'>202314'}>} Price)) <=5"} >}Price)

 

lost_rabbit
Contributor III
Contributor III
Author

Tried this already. Unfortunately it returns 0 if I replace double quotes with single quotes

Chanty4u
MVP
MVP

May be thus 

 

=sum({<Customer={"=Rank(Sum({<ExpYrWk={'>$(=max({<ExpYrWk={'>202314'}>}ExpYrWk))'}>}Price))<=5"}>}Price)

 

lost_rabbit
Contributor III
Contributor III
Author

Nope. Doesn't work. Returns 0 

Kushal_Chawda

@lost_rabbit  you need to escape double quotes in inner set as you already used it in outer set like below

= sum({<Customer= {"=Rank(Sum({<ExpYrWk ={"">202314""}>} Price)) <=5"} >}Price)

maxgro
MVP
MVP

You can try with [ ]   

 

From https://community.qlik.com/t5/Design/QlikView-Quoteology/ba-p/1476029

Today, in Set Analysis, it doesn't matter whether you use single or double quotes. They both interpret the content according to bullet two below. But it should matter. There is a bug here... And one day it will get fixed.

It should be this way:

  • Single quotes: Literal match with field value. Case sensitive.
  • Double quotes: A search. The string may start with < or > for numeric searches. May start with = for expression searches. May contain wildcards. Case insensitive. Double quotes can be exchanged with [ ].
lost_rabbit
Contributor III
Contributor III
Author

Thanks. This worked 🙂 

lost_rabbit
Contributor III
Contributor III
Author

@Kushal_Chawda Kindly check my follow up question here