Skip to Content

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

Add/Remove measures at run time to a crosstab component

Hi Experts,


I have a scenario in Design Studio where I need to assign measures at run time to Crosstab component from same data source.

Our BEX query has SalesValue TY, SalesValue LY, SalesQty TY, SalesQty LY measures.


When I select Value from drop down, I would like to display SalesValue TY and SalesValue LY measures in Crosstab component and when I select Qty from dropdown, I would like to display SalesQty TY and SalesQty LY measures from the same source in same crosstab component.

I do not want to have two data sources and two crosstab components and hiding/showing them at run time.

I am able to add dimensions to crosstab component at runtime by using below two methods.

DS_1.moveDimensionToColumns(dimension, position?)

DS_1.moveDimensionToRows(dimension)

Did any one tried add/remove measures at runtime to Crosstab component? I know we need to filter measures of data source at run time but not finding any suitable methods.

Please guide me.

Thanks,

Satyam

Former Member
replied

Hi Satyam,

To be specific, you would need to code the "On Select" event script of the dropdown list to look similar to the following:

if (me.getSelectedValue() == "V") {

// Filter Value Measures

  DS_1.setFilter("006EIC2OSTY2YAK2X13HZAWTE", ["006EIC2OSTY2YAK2X13HZB34Y", "006EIC2OSTY2YAK2X13HZB9GI"]);

}

// Filter Quantity Measures

else {

  DS_1.setFilter("006EIC2OSTY2YAK2X13HZAWTE", ["006EIC2OSTY2YAK4A4L7YHZFM", "006EIC2OSTY2YAK4A4L7YI5R6"]);

}

In the setFilter() method, the first parameter represents the ID of the Measure Dimension.  The second parameter is an array of the Measure Dimension Member IDs for the Value measures in the first case and Quantity measures in the second case.

The result is as follows:

Regards,

Mustafa.

1 View this answer in context

Helpful Answer

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