I created the following saved formula “PAYMENT_IN_DISCOUNT_PERIOD” in order to calculate the percentage of vendor invoices which were paid within the discount period:
SUM(CASE WHEN PROCESS EQUALS ‘Clear Invoice’ TO ANY TO ‘Cash Discount Due Date passed’ THEN 1.0 ELSE 0.0 END)
SUM(CASE WHEN “BSEG”.“ZBD1P” > 0 THEN 1.0 ELSE 0.0 END)
Now I want to display the company code (=dimension) with the highest rate (=KPI) in an OLAP table. In order to get this result, I used the following statement:
I always get the error that an aggregate expression cannot be nested in another aggregate expression. I know that I have to bring the aggregation in my saved formula to another level with an alias, but how does this work in PQL?