Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

crystal report 2008- how to turn number into percent

Status
Not open for further replies.

hlmnsbuggy

Technical User
Mar 25, 2002
72
0
0
US
Crystal 2008

I try to follow 2008 crystal report crosstab sample named comparative Income statement to get percent difference between actuals and budget. I had a problem to show the difference with ‘ %’, if I click percent in the toolbar, all actual, budget numbers and percent difference are turned into percent, that is not what I want, I want only percent difference is %. This is their code from calculated member, edit calculation formula

local numbervar N := 0;
local numbervar M := 0;

N := GridValueAt(
CurrentRowIndex,
GetColumnPathIndexOf(
date(tonumber(right({?Column1 - mm/yyyy},4)),
tonumber(left({?Column1 - mm/yyyy},2)),
01),
{?Column1 - type}),
CurrentSummaryIndex);
M := GridValueAt(
CurrentRowIndex,
GetColumnPathIndexOf(
date(tonumber(right({?Column2 - mm/yyyy},4)),
tonumber(left({?Column2 - mm/yyyy},2)),
01),
{?Column2 - type}),
CurrentSummaryIndex);

if M = 0 then 0
else ((M-N)/M)*100

Please help, your advice will be greatly appreciated

Ann
 
I don't have CR2008, but you could try changing the last clause to:

if M = 0 then
"0%" else
totext((M-N)% M, 2)+"%" //2 for two decimals

It seems to me though that as long as you only have the percent summary selected, clicking on the % sign in the toolbar should only change that summary--but again, I don't have CR2008, so I guess it could be a bug.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top