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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field doubling amount when calculating

Status
Not open for further replies.

jackie1948

Programmer
Jan 25, 2002
78
US
i have a report that has a break that produces a summary line and on this line i have 3 calculated fields. the results are correct on the report except for 2 different account numbers and on these the amounts are doubled on all 3 calculated fields. I have checked and rechecked the data in the file and there is not any duplicates. My question is has anyone got any suggestions on how to solve this problem.
 
If you're grouping in your report, the duplicate records would not show up.
Try adding "DISTINCT" to your calculation to test this.
eg: Total(DISTINCT Rev_Amt)

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
DoubleD
Thanks I do not know why I have not thought about using distinct as I have used it a thousand times before. That worked for the first 2 calculation but on the last one I still need to work on. But atleast you pointed me in the right direction to fix this problem.
again a Big Thanks
 
Sounds like you have another table joined to your main fact table that has multiple rows for the data in question. Can you post the SQL the report is generating here so we can look at it?

Dave Griffin


The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ401-2487 first!
 
Without examples it hard to know what you have done. If you are using CRN you can review at the cube or tabular query level the logical SQL and native SQL. In the logical queries you will observe for aggregations a notation that defines what partition of data an aggregate is computed over and the set of unique column values at which the aggregation is computed with the partition. This avoids 'double' counting which happens when relationships cause multiple rows to be generated etc.

Typically, you would not explicitly specify the for-clause on an aggregate expression and leave the engine to determine the context but you do so if you want.

Either way.. without context hard to specifically what your root cause and appropriate solution is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top