2 Replies Latest reply on Mar 29, 2015 11:45 AM by sccardais

# Format number in Chart Title based on Calculation

### Title

Format number in Chart Title based on Calculation

### Post

I want to format a number (Summary field) that is part of a chart title created with a calculation as shown on the attached screenshot.

The calculation for this Chart Title is shown below. The field name is highlighted in red.

"Annual Contract Value: " & If
(
ValueCount(TO_name::_Edition) = 1;
Upper(TO_name::g_Edition & " " & TO_name::SummaryField);
"ALL EDITIONS"&" " &  TO_name::SummaryField
)

Is there a way to format this Summary field as Currency or at least with thousands separator?

• ###### 1. Re: Format number in Chart Title based on Calculation

Definitely possible. Is this always a whole number or might there be a decimal component that's part of the value?

A quick search of my tutorial section of the Known Bugs List database brings up one calculation for decimal points that I've adapted to include a currency symbol:

Let ([ x = YourNumberFieldHere ;
I = Int ( x ) ;
d = Mod ( x ; 1 )
];
"\$" & I & If ( d ;  Left ( d & "0" ; 3 ) ; ".00" )
)

And I found a clever trick from raybaudi for the thousands separator:

NumToJText ( 1234  ; 1 ; 0 )

Will return: 1,234

• ###### 2. Re: Format number in Chart Title based on Calculation

Thank you. The NumtoJText "trick" worked well. Adding the "\$" to the beginning of the calculation gives it the apprearance of formatting as "Currency." The SummaryField value of 6099840 now appears as \$6,099,840.

Final calculation below.

"Annual Contract Value: " & If
(
ValueCount(TO_name::_Edition) = 1;
Upper(TO_name::_Edition & " \$" & NumToJText (SummaryField ; 1 ; 0 ));
"ALL EDITIONS"&" \$" &  NumToJText ( SummaryField ; 1 ; 0 )
)