Skip to Content
0

Swap key figures on radiobutton selection

Mar 23, 2017 at 11:10 AM

212

avatar image

Dear Experts,

I am trying to achieve a functionality where I have three radio buttons named Revenue Margin and Volume and then there then two charts showing the data for top/bottom 5 performers based on Revenue/margin and Volume by Customers.

At the moment, I have used the the following script the change the key figure based on the radio button selection.

if (RADIOBUTTONGROUP_1.getSelectedValue()=="Volume") { INFOCHART_1.setDataSelection({ "Keyfigures": "Volume"}) ;}

and similar code for Revenue and margin radiobutton selection.

However, the problem is that I have selected the top/bottom 5 customers based on Margin (default selection) manually.

Now, when i change the radiobutton from Margin to Volume, I could see more than 5 customers rather than just top 5 customers based on the volume.

Is there any way to handle the top 5 customers to implement with the help of script and then change the key figure dynamically

Regards

Sumit

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Mustafa Bensan Mar 23, 2017 at 01:01 PM
1

Hi Sumit,

Can you clarify exactly what you mean by "I have selected the top/bottom 5 customers based on Margin (default selection) manually"?

Unfortunately, there is no script method for applying Top N / Bottom N filtering directly on a data source. If your data source is a BEx Query then I would suggest that you create separate Top 5 / Bottom 5 Conditions for Revenue, Margin and Volume in the query definition. You can then activate the required condition by script based on the radio button selection by applying the setMeasureFilterActive() method on the data source.

Here are some posts that describe the use of BEx Conditions in Design Studio that you may find helpful:

Working with BEx Conditions in SAP BusinessObjects Design Studio

Switch BEx Conditions on demand from SAP BusinessObjects Design Studio

Regards,

Mustafa.

Show 4 Share
10 |10000 characters needed characters left characters exceeded

what you said that is correct. But from universe data source, we can't achieve the Top N / Bottom N. So in our project we are using the below example,

var P= DS_1.getMembers("dimension", 10); 
DS_1.setFilter("dimension",P);
0

Yes but even with a universe data source, how are you able to obtain a Top N / Bottom N with this code? Is it assuming that the Universe data source has already been sorted in ascending/descending order of a particular measure first?

0

Yes your right. we are doing ascending/descending order for particular measures in Query panel. And then we are using getMembers() function to get max / min numbers of data in the data source. After that we using setFilter() function to filter the data source and get the output.

0

Okay, thanks for the clarification. That makes sense now :)

0
Vidhya V Mar 23, 2017 at 11:38 AM
0

Hi Sumit,

For implementing Top/Bottom 5 Customers, Please check the below code

DS_1.getMembers(dimension, maxNumber)

var P= DS_1.getMembers("dimension", 10); 
DS_1.setFilter("dimension",P);

And for changing the key figure dynamically, Please check the below link,

https://archive.sap.com/discussions/thread/3490636

Regards,

Vidhya.C

Show 5 Share
10 |10000 characters needed characters left characters exceeded

If you need more details please check this,

https://archive.sap.com/discussions/thread/3287130

0

Hi Vidhya,

Thanks for your response.

I tried this and it worked perfectly well for top performers but I don't get the bottom 5 performers from the same data source.

I have 200 odd customers in the datasource bringing from the BEx query and would like to use the same data source and use it in two different charts showing top/bottom 5 customers filtered from the entire data set.

Would that be possible to do it?

0

Create copy of current data source and use it for bottom 5 performers.

Are you using BEx query? We have option to do Top N / Bottom N in SAP Business Explorer (BEx) itself.

Please check the below URL,

http://visualbi.com/blogs/design-studio/general/working-with-bex-conditions-in-sap-businessobjects-design-studio/

Regards,

Vidhya.C

0

Hi Vidhya,

Thanks for your response.

I am using CSV data for the prototyping purpose and I know the functionality of how to get this done from BEx.

However, as per your recommendation let me create another data source for bottom 5 values and confirm on the same. I am expecting that to work..

Thanks

Sumit

0

Hi Vidhya,

Can you clarify how the getMembers()/setFilter() script example above can retrieve the Top 5 / Bottom 5 Customers when the key figure changes? I'm not sure how this would work.

Thanks,

Mustafa.

0