Jump to content
Sign in to follow this  
nick_jp

Division Sub-summary issue

Recommended Posts

Hi,

I have a system which sores books sold and their publisher. A report I need to display will take any subset of "sales" and give the following sub-summaries:

a) The total number of sales in the found set for each publisher in the found set

:) The percentage of the "number of sales for each publisher" compared with the total number of sales in the found set (for all publishers).

Fairly simple, if you have 1000 records, and two publishers in the found set, with PubA having 200 records and PubB having 800 records then PubA will have 20% and PubB will have 80%.

Sub-summary (a) from the above is displaying correctly. However Sub-summary (:) is displaying an incorrect percentage. The number is close but incorrect, and I'm not sure if it's a number storage precision problem or if I'm trying to do something you shouldn't be able to.

Please see that attached, the important numbers are "Total Adoptions", gn_RecordCount and Market_Share_Fraction. The market share fraction for MLH (top) should be 94.18% according to my calculator...

I've attached a pic "Definition" showing how the summary fields are defined:

The "Total Adoptions" is referencing sn_Adoption_Count, this is correct

The MarketShare_Fraction is referencing "sn_MarketShare_Fraction", this is displaying wrongly right now.

I've spent a few hours hacking around trying to figure this one out. If anyone could help me that would be great.

-Nick

Picture_2.jpg

Definition.png

Share this post


Link to post
Share on other sites

I don't understand this too well (a sample file would be more helpful than the screenshots). I am guessing the 4 numbers are sub-summaries themselves, and that they count the PK of the actual records.

If so, it's pure coincidence that you are getting a result that is close to the expected. Your summary field, sn_MarketShare_Fraction, is defined as Fraction of Total - which means it ADDS the ID's, not COUNTS them. The only time this would work correctly would be when all records have the same PK value.

Try a calculation field =

GetSummary ( sn_Adoption_Count ; Publisher? ) / sn_Adoption_Count

Share this post


Link to post
Share on other sites

Hi and thanks for the reply. I'll try to get a sample file together but I didn't make the original report so it may take a while.

The grey part on the report with the market share number is a sub-summary sorted by title::publisher, where title is a parent of adoption. So yes, the fields are all sub summary fields.

I had tried the GetSummary script step as you suggested before actually and didn't get anywhere.

Please see the attached pics where I try to define two cal fields to get the summary numbers, and also to display them. As you can see they can't reference data. Is this because the part is already a sub-summary part?

Picture_2.png

Picture_3.png

Share this post


Link to post
Share on other sites

Actually, I just hacked a workaround, if you have a field in the adoption table that = 1 for every record then you get the correct data for the "Fraction of total" sub-summary step. Would still like to know why the other GetSummary fields don't work but at least I have a way forward.

Share this post


Link to post
Share on other sites

GetSummary() only works when breakField is a local field (in the same table). You can use the matchfield to the title table as the breakField - but the sub-summary and the sort order need to be changed accordingly. If this creates a problem with the sorting order, you can define an unstored calc = title::t_Title_Publisher and use that instead.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.