Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Line chart

Hi guys,

I want to show last 12 month sales of products  based on the top 5 products sold in the current month.

Thanks in advance.

6 Replies
Anil_Babu_Samineni

Try like this

Sum({<Products = {'$(=Rank(products)<=5)'}, month = {'$(=AddYears(Max(month),-1))'}>} sales)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

Hi Anil,

If we use this Formula in an expression it will return only the current month data.  I want to show the last 12 month trend of these top products.

sunny_talwar

May be like this:

Sum({<Products = {"=Rank(Sum({<MonthYear = {'$(=Date(Max(MonthYear)))'}>}Sales)) < 6"}, MonthYear = {"$(='>=' & Date(MonthStart(Max(MonthYear), -12)) & '<=' Date(Max(MonthYear)))"}>} Sales)

Here, create MonthYear field in the script like this

LOAD TempDate,

          Date(MonthStart(TempDate)) as MonthYear

FROM ....

rahulpawarb
Specialist III
Specialist III

I like the way you derive solution... The most simplified form..

Anil_Babu_Samineni

Would you mind, Please share the application?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar