English 中文(简体)
A. 组合不同价值概述
原标题:Sum of the grouped distinct values

很难用词解释...... I m试图在矩阵中计算一组不同数值。 我要说的是,我有以下数据通过QQL:

------------------------------------------------
| Group | ParentID | ChildID | ParentProdCount |
|     A |        1 |       1 |               2 |
|     A |        1 |       2 |               2 |
|     A |        1 |       3 |               2 |
|     A |        1 |       4 |               2 |
|     A |        2 |       5 |               3 |
|     A |        2 |       6 |               3 |
|     A |        2 |       7 |               3 |
|     A |        2 |       8 |               3 |
|     B |        3 |       9 |               1 |
|     B |        3 |      10 |               1 |
|     B |        3 |      11 |               1 |
------------------------------------------------

查询中还有其他一些数据,但并不重要。 家长教育是专门针对家长教育的。

现在,我在“管理报告设计员”中有一个矩阵,试图计算父母子女(由“小组”组组)的一笔款项。 如果我只补充这一表述的话。

=Sum(Fields!ParentProdCount.Value)

I get a result 20 for Group A and 3 for Group B, which is incorrect. The correct values should be 5 for group A and 1 for group B. This wouldn t happen if there wasn t ChildID involved, but I have to use some other child-specific data in the same matrix.

我试图确定飞行情报和安全局(IRST)和SUM(SUM)的总职能,但显然不可能规定放弃职能,即使它们有界定的范围。

我确信,在不必另立问题的情况下,计算有组别的单独款项的方法有些。 没有人想到如何这样做?

最佳回答

Ok I通过增加一个ROW_NUMBER(NUMBER)功能,来消除这种局面:

SELECT Group, ParentID, ROW_NUMBER() OVER (PARTITION BY ParentID ORDER BY ChildID ASC) AS Position, ChildID, ParentProdCount FROM Table

之后,我取代SSRS SUM的职能。

=SUM(IIF(Position = 1, ParentProdCount.Value, 0))
问题回答

安排一个小组,负责家长教育,并对该团体进行总结,

指称:

if group over ParentID =  "ParentIDGroup" 
then 
    column sum of ParentPrdCount = SUM(Fields!ParentProdCount.Value,"ParentIDGroup")




相关问题
Django aggregation get_*_display function usage

This question relates to Django Aggregation/Annotation in 1.1. Suppose I have a simple model with an IntegerField that has a "choices" parameter passed to it. In this case, it maps to a GENDERS ...

Aggregating SQL rows with precedence

I have a table full of items from different sources. Some of the sources might have the same location (in my example, different BBC news feeds would be different sources, but they all come from the ...

Summarizing two conditions on the same SQL table

Given a SQL table Transactions ID INT COMPANY_ID INT STATUS INT where STATUS IN (0,1) indicates a free transaction and STATUS IN (2,3) indicates a billable transaction, ...

Understanding UML of DoFactory Design Pattern - Decorator

I am trying to understand UML diagram describing Decorator Pattern at link below http://www.dofactory.com/Patterns/PatternDecorator.aspx I don t understand why there is a "Aggregation" relation ...

Jamon statistics aggregation across multiple JVMs

I have a tomcat server running a webapp. Apart from this there are two other JVMs that run batch processing tasks. Jamon is a really cool way to monitor performance, hits etc., and can be viewed on ...

Optimise aggregation query

I m looking for a way to optimise the following: SELECT (SELECT SUM(amount) FROM Txn_Log WHERE gid=@gid AND txnType IN (3, 20)) AS pendingAmount, (SELECT COUNT(1) FROM Txn_Log WHERE gid = @...

Data Aggregation :: How important is it really?

I m curious to know where people value Data Aggregation. I m truly curious, if you don t mind letting me know how important this really is to you personally with respect to your work environment, and ...

热门标签