Hi,

I have this formula field:
WhilePrintingRecords;
Sum ({%SQL_COUNT_99245}, {%SQL_ORDER_DEFINE});

Sql expression field SQL_COUNT_99245) code is:
DECODE(TRIM("EMSUMMARY_VIEW"."ADJ_PROC_CODE"),'992 45',1,0)

The sql expression field SQL_ORDER_DEFINE code is:
trim(substr("PROVIDER"."PROVIDER_NAME",(instr("PRO VIDER"."PROVIDER_NAME",' ')+2),length("PROVIDER"."PROVIDER_NAME"))) ||' '|| substr("PROVIDER"."PROVIDER_NAME",1, instr("PROVIDER"."PROVIDER_NAME",' ')-1)

The SQL_ORDER_DEFINE is only reversing the last name first name positions.

My goal is to get the formula field above to count distinct. Is there a way to do that?

Thanks