cancel
Showing results for 
Search instead for 
Did you mean: 

Access to all filter values in a FilterPanel for variable calculations

Former Member
0 Kudos

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!

Accepted Solutions (1)

Accepted Solutions (1)

TammyPowlas
Active Contributor
0 Kudos

Hi Carl,

Would you consider making these gross profit calculations in your BEx Query as calculated key figures?  I think your application's performance would be faster.

Former Member
0 Kudos

Hi Tammy,

Thank you for the very quick response!

Perhaps my example was not the best, I do agree that having Gross Profit calculated within the BEx query would be best.

My real example is calculating the Gross Margin %, which is the Gross Profit / Sales. Since you can never be quite sure what dimensions are being applied in the context of a percentage, most often it is calculated at the report level. So, having said that, I am trying to calculate Gross Margin % within the application.

So, perhaps the question is still valid (unless I could get help convincing the BEx query developer that percentages would always be calculated accurately for all combinations of characteristics 😉  ).

Thanks!

Answers (0)