I want to add a condition to my query that return a certain number of business partners (based on percentage). If I use the Top % i condition I can only reference my key figures and not the characteristic 0bpartner.
Ex: Give me 70 % of my best business partners based on revenue. If i have 1 million business partners i would like to receive 700 000 in my query.
I dont think that you can achieve it directly in BEx.
The reason is the following: all percentage functions in the BEx formula builder will work on a KFs values, not on number of records in master data table.
Using user exit will not help either. You can determine a definite percentage of bpartners reading master data table and populating exit variable with multiple choices. But, you need to select this percentage according to revenue, right? Revenue will depend on selections: time period, regions, types of bp etc. You cannot know beforehand which selection criteria the user may apply. Hence you cannot get needed percentage BEFORE query execution.
The only way, IMHO, to achieve it to execute a query with a condition for, say, Top 99.99% (in order to get the list sorted). Embed this query into worksheet of the workbook. Here should be an exit variable within the query (even might be the 2nd query) which will return (and show in the result area or in the variables and parameters header) the number of distinct bpartner codes. In the neighbor sheet using VBA macro copy the needed percentage of rows and show them in the second sheet.