Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression

Hi Experts

I have an expression for MTD sales

Sum({< MonthYear=, Date = {'>=$(=Date(MonthStart(vMaxSalesDate)))<=$(=Date(vMaxSalesDate))'} >} Sales)

and I want to choose top 5 customers for each branch

SUM({<Customer = {"=Rank(SUM(Sales),4)<=5"}>}Sales)

How  can i combine these two expressions together

Please Help

13 Replies
sunny_talwar

Try this may be:

Sum({<MonthYear=, Date = {'>=$(=Date(MonthStart(vMaxSalesDate)))<=$(=Date(vMaxSalesDate))'}, Customer = {"=Rank(Sum({<MonthYear=, Date = {'>=$(=Date(MonthStart(vMaxSalesDate)))<=$(=Date(vMaxSalesDate))'}>}Sales),4)<=5"}>} Sales)

Not applicable
Author

HI

its providing all the values as null

sunny_talwar

‌Does your 2 expression give you a non-null output when used separately? I made the assumption that the two expressions work individually and they just needed to be combined somehow. Let me know if one or the other doesn't work cause then we will fix one piece at a time.

Best,

Sunny

Kushal_Chawda

Try like this,

SUM({<Customer = {"=Rank(SUM({< MonthYear=, Date = {'>=$(=Date(MonthStart(vMaxSalesDate)))<=$(=Date(vMaxSalesDate))'}>}Sales),4)<=5"}>}Sales)

Not applicable
Author

HI

Part of the expression is working
Here with this I Attached the QVW and the Data please Have a look

Not applicable
Author

HI kush

Its providing lots of null values

sunny_talwar

Great, the sample would help, but in addition would you be able to let us know what your expected output looks like? For example if you select Apr 2015 what would you like to see??

Best,

Sunny

Kushal_Chawda

See the attached

Not applicable
Author

HI

Thanks Kush

if you add branch to Dimensions

the out put result should be by Branch Top 5 customers

Now its providing top 5 customers

Please help