I have a quite complex query to calculate a KPI and want to limits its result to a maximum value.
This max value is stored in a variable with an absolute value of e.g. 2.
If the actual result of the KPI is higher than 2 the PQL should return 2.
I set this up as an CASE WHEN but this is repetitive code which is badfor readability and maintainabilty.
Are there more consise approached possible with PQL? e.g. using a Max(KPIcode, Limit) Excels Max function works something like this. But PQL Max works only on a column.
just for reference my PQL looks something like this:
CASE WHEN (... 5 lines of code to calculate KPI) > <%= Limit %>
THEN <%= Limit %>
ELSE (... 5 lines of code to calculate KPI)
END