Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rajveersinghsisodiya
Contributor III
Contributor III

Which year has max sales

Hi All,

I have a line chart with month as dimension

i have monthly wise five year of data including current year.

requirement are:

1.    One line as  Current year  sales data

2.    And another line  as year which has max sales.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can simplify the set expression a bit using Rank() function:

=Sum({<Year = {"=Rank(Sum(Sales))=1"}>}Sales)

And if the OP wants to find the year with max monthly sales:

=Sum({<Year = p({<MonthYear = {"=Rank(Sum(Sales))=1"}>}) >} Sales)

Attached the modified version of Sunny's sample

View solution in original post

7 Replies
swuehl
MVP
MVP

Max sales total on a given year or max sales on a month?

sunny_talwar

Looking for something like this?

Capture.PNG

swuehl
MVP
MVP

You can simplify the set expression a bit using Rank() function:

=Sum({<Year = {"=Rank(Sum(Sales))=1"}>}Sales)

And if the OP wants to find the year with max monthly sales:

=Sum({<Year = p({<MonthYear = {"=Rank(Sum(Sales))=1"}>}) >} Sales)

Attached the modified version of Sunny's sample

rajveersinghsisodiya
Contributor III
Contributor III
Author

Hi swuehl‌ thank you so much ...:).

sunny_talwar

So what were you looking for? The first solution or the second one. Just curious

rajveersinghsisodiya
Contributor III
Contributor III
Author

actually i have used the expression given by SWUEHL .. i haven't open the example given by you...  because i am using personal edition .