Skip to Content
avatar image
Former Member

Top N ranking in design studio by scripting

Dear All,

I'm trying to get Top 5 Material Group in an info-chart by using scripting.

To achieve this, I am referring to this blog (

If I sort descending based on CY- Actuals in edit initial view, I get the following results, where the top 5 are 0143, 0279, 0030, 0204 and 0009.

However, by applying the scripting as below, I get different Top 5(0001, 0003, 0002, 0009, # not assigned). The top 5 returned are the first 5 Material Groups sort ascending by key and it rank the first 5 material group according to the CY-Actuals.

Can anyone tell me how can I get the top 5 according to CY- Actuals for all material groups instead of the first 5 material group?

Thank you.


Pei Shi

u2bwd.png (15.4 kB)
c6emh.png (25.3 kB)
di1ki.png (39.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jul 31, 2017 at 09:26 AM

    Hi Pei Shi Hee,

    We have two options,

    1. In design studio , while adding the data source, In Edit Query Specification, we can added the ranking filter in the Query Filter panel itself, Please find the below screenshot,

    It will work for any Data Source.

    After adding this, try to add this script,

    	var top10cust=DS_1.getMembers("_eaTRsbh0EeWuS70gbqxHFA", 10);
    	DS_1.sortByMeasure("_NZW_IM7vEeWmlZgk6MSEDA", true);

    2. If it is BW , Using Bex Condition, we can achieve this,



    Add comment
    10|10000 characters needed characters exceeded