Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Top three values per month

I'm trying to build a bar chart (using a standard Qlik sense component or the Picassa extension).

I need 3 bars PER MONTH that represent my top 3 categories per month based on total revenue of that category.

SampleBar.PNG

While my sample chart does not show it, the top 3 categories will be different every month.

Best I can tell, I need to make 3 data series

=Dual(Aggr( If(Rank(Sum(REVENUE))=1, CATEGORY_NAME),  MonthYear, PHY_SPEC_DESCR),

           Sum( Aggr( If(Rank(Sum(REVENUE))=1, Sum(REVENUE)),  MonthYear, CATEGORY_NAME))

          )

=Dual(Aggr( If(Rank(Sum(REVENUE))=2 CATEGORY_NAME),  MonthYear, PHY_SPEC_DESCR),

           Sum( Aggr( If(Rank(Sum(REVENUE))=2, Sum(REVENUE)),  MonthYear, CATEGORY_NAME))

          )

=Dual(Aggr( If(Rank(Sum(REVENUE))=3, CATEGORY_NAME),  MonthYear, PHY_SPEC_DESCR),

           Sum( Aggr( If(Rank(Sum(REVENUE))=3, Sum(REVENUE)),  MonthYear, CATEGORY_NAME))

          )

Is there a simpler way to do this?  I'm not confident that I'm getting the right data out.

Thanks, Mark

Labels (1)
1 Solution

Accepted Solutions
BalaBhaskar_Qlik
Master
Master

1 Reply
BalaBhaskar_Qlik
Master
Master