# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Join us on May 23rd, Q&A with Qlik - Developer Series, Customizing Extensions: Register Today
cancel
Showing results for
Did you mean:
Creator II

## Rank Grouping By Dimension expressions

Hello Everyone,

I want to rank the products based on the two measures (Sales and Actuals). With this expression, I was getting the following results. But what I was expecting is different. Can you please help me in building the right expression.

=if(aggr(rank(sum([Sales])),[Product ID])<= 3,'Top 3 Product Sales',

if(aggr(rank(sum([Actuals])),[Product ID])<= 3,'Top 3 Product Actuals'

))

Result:

RankDimensions
1Top 3 Product Sales
2Top 3 Product Sales
3Top 3 Product Sales
4Top 3 Product Actuals
5Top 3 Product Actuals
6Top 3 Product Actuals

Expecting:

RankDimensions
1Top 3 Product Sales
2Top 3 Product Sales
3Top 3 Product Sales
1Top 3 Product Actuals
2Top 3 Product Actuals
3Top 3 Product Actuals

Question Modified from above:

From the below sample table. I want to create the dimension expression pivot table. I considered using the ranking for this approach but I am not getting the results as expected.

sample data table:

 Product Sales Amount Actual Amount Risk Value Return Value A 60 5 20 15 B 50 100 25 25 C 70 70 55 35 D 20 35 15 30 E 10 25 17 15 F 5 30 20 20

Expected Result:

 Dimension Risk Value Return Value Average of TOP 3 Products by Sales Amount 33.33 25 Average of TOP 3 Products by Actual Amount 31.66 30

-Vidya

Message was edited by: vidya sagar malla

5 Replies
MVP

Your dimension seems to return the expected results. I guess you are actually asking about the Rank expression?

How have you defined this expression? I would assume quite similar to your dimension?

Creator II
Author

Hi Stefan,

Yes, I defined this expression. But I was not getting the results as expected resultset. I am developing this in a Qlik Sense.

Thanks,

-Vidya

Creator II
Author

and Yes i need a rank expression here.

Thanks,

-Vidya

Partner

Hi,

Try this in expression not in dimension.

=if (rank (total (sum([Sales])))<= 3,'Top 3 Product Sales',

if (rank (total (sum([Actuals])))<= 3,'Top 3 Product Actuals'

))

Creator II
Author

Hi Jomar,

The Expression is not working as expected. let me update the question with some sample data.

Thanks,

-Vidya