Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Access to all filter values in a FilterPanel for variable calculations

I am using a Filter Panel within my application to filter all components within the application. My data source does not contain some required key figures, so I must calculate those at run time (e.g. Gross Profit = Sales - Expenses).

On Startup, I can successfully calculate the Gross Profit using a global variable within the On Startup event handler. My challenge is to recalculate this variable when the data source gets filtered from within the Filter Panel.

On Startup, I calculate Gross Profit as follows:

var v_ytd_sales = DS_1.getData("Sales", {}); // unfiltered Sales key figure

var v_ytd_expenses = DS_1.getData("Expenses", {}); // unfiltered Expenses key figure

g_gross_profit = v_ytd_sales.value - v_ytd_expenses.value;

Since I need to access the key figures that comprise Gross Profit individualy for the calculation, I am not sure how to get all the filters that have been applied within my Filter Panel (e.g. Division, Region, Area, Customer, Industry, etc.).

Do I need to get the data for each dimension that appears in the Filter Panel (as name value pairs) and aggregate myself?

     e.g. var v_ytd_sales = DS_1.getData("Sales",  {"ZCDIVISION":"<filtered value>", "ZCREGION":"<filtered value>", etc.});

Or, is there shortcut somehow that can be used to get the data for the data source as it is currently filtered with the Filter Panel?

Any help would be greatly appreciated... thanks in advance!

Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question