I'm glad you like it.
I forgot the server.. ;)
If you want, the same result, for the server, not using the function, the query can do it with..:
select
OriginalData.ProfileID,
Name,
Profile1, Profile2, Profile3, Profile4,
MINP
from OriginalData left join
(
select ProfileID...