I have requirement to display aggregate result values in visualforce page and it should be formatted to currency. Could anyone help me with this issue i am facing.

apex controller:

RepSalesbyFund = Database.query('SELECT sum(Twelve_Month_Purchase__c) Twelve_Month_Purchase__c FROM RepSalesByFund__c where Rep_GroupID__c in :searchedConIds order by ' + sortFullExp + ' NULLS LAST limit 1000');

Visualforce page:

     <apex:column value="{!a['Twelve_Month_Purchase__c']}"  style="Color:{!IF(a['Twelve_Month_Purchase__c'] < 0,'red', 'blue')}">
     <apex:facet name="header">  
       <apex:commandLink action="{!rsbfViewData}" value="12 Mos Purch{!IF(a['Twelve_Month_Purchase__c'],IF(rsbfsortDirection='ASC','▼','▲'),'')}" reRender="rsbfpageBlock">
         <apex:param value="SUM(Twelve_Month_Purchase__c)" name="column" assignTo="{!rsbfsortExpression}" ></apex:param>

1 Answer 1


You can format the value to diaplay as currency like this:

<apex:outputText value="$&nbsp{0, number, 000,000.00}">
<apex:param value="{!a['Twelve_Month_Purchase__c']}" />

Please let me know if this helps

  • Couldn't you just include it in the format string itself?
    – Adrian Larson
    Jul 18, 2016 at 19:51
  • Thanks ..Actually it works. It just tweaked a bit. <apex:outputText value="{0, number, currency}"> <apex:param value="{!a['Twelve_Month_Purchase__c']}" /> </apex:outputText>
    – Dinesh
    Jul 18, 2016 at 20:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .