Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Sort by Embedded Summary Post Reply Post New Topic
Author Message
brain
Newbie
Newbie


Joined: 13 Apr 2010
Online Status: Offline
Posts: 36
Quote brain Replybullet Topic: Sort by Embedded Summary
    Posted: 18 Nov 2017 at 2:45am
Crosstab report.
Row by customer name.
Columns by month.
Also a grand total column
Two summarized fields: Profit & TotalRevenue
I added Embedded Summary to divide Margin by TotalCharge to produce margin: profit as a percent of total revenue by customer.

Here is the embedded summary calculation formula:

If
     GridValueAt(CurrentRowindex, CurrentColumnIndex, CurrentSummaryIndex-1) = 0
then
     0
else
     (GridValueAt(CurrentRowindex, CurrentColumnIndex, CurrentSummaryIndex-2)
     /
     GridValueAt(CurrentRowindex, CurrentColumnIndex, CurrentSummaryIndex-1) )
     *100

This all works, but how do I now get my rows to sort by the profit % (i.e. by the Embedded Summary, or at least by the same formula)? I tried adding a formula Profit/TotalRevenue to the report (not to the Crosstab) on the theory that I could then sort by it, but that generated the overall margin% for all customers combined and put it on each row, rather than calculating the margin within each row.


Edited by brain - 19 Nov 2017 at 8:03pm
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.