简体   繁体   English

我们可以在ssrs报表构建器中获取表的同一列的上方单元格的值吗? 怎么样?

[英]can we get value of above cell of same column of table in ssrs report builder? How?

I have edited my question and replace the previous explanation with new one. 我已经编辑了我的问题,并用新的替换了以前的解释。 I think I could't explain my problem clearly before. 我想我无法清楚地解释我的问题。 here is my scenario: 这是我的情况:

Col1  |Col2  |Col3  |Col4   |Col5  | Col6  
------|------|------|-------|------| 3333.00 (Table 1)  
------|------|------|  15.00|  0.00| 3348.00 (Table 2)  
------|------|------|   0.00|550.00| 2798.00 (Table 2)
     Sub ToTal:-----|  15.00|550.00| 2798.00 (Table 3)

In this report value (3,333.00) of Table 1 is Opening Balance. 在此报告中,表1的值(3,333.00)为期初余额。 For Table2 and Table3, col4 is Deposit and Col5 is Withdraw. 对于表2和表3,col4为存款,而Col5为提现。 Last column of Table2 and Table3 are closing balance. 表2和表3的最后一列是期末余额。 So, the rule is, closing balance of first row of Table2 should be calculated as (ClosingBalance = OpeningBalance + Deposit - Withdrawal). 因此,规则是,表2第一行的期末余额应计算为(ClosingBalance = OpeningBalance +存款-提款)。 and Closing Balance of 1st row should be opening Balance for second row. 并且第一行的期末余额应为第二行的期初余额。 Table 3 has nothing to do with them. 表3与它们无关。

Now problem is that 3333.00 is coming from query so we can easily calculate 3348.00 but i dont know how to calculate 2798.00 as it required value of above cell which is 3348.00. 现在的问题是3333.00来自查询,因此我们可以轻松地计算3348.00,但我不知道如何计算2798.00,因为它需要上述单元格的值3348.00。 similarly if Table 2 generate 10 rows than 1st value of last column should be calculated from 3333.00 and remaining rows will calculate their values from above cell ie 2798.00 depends on 3348.00 and if there is next row than it will depend on 2798.00. 类似地,如果表2生成的行比上一行的第1个值多10行,则应从3333.00计算得出,其余行将从上面的单元格计算它们的值,即2798.00取决于3348.00,如果还有下一行,则取决于2798.00。 so i have done this: 所以我做到了:

IIf(RowNumber(DatasetName) = 1, value of Table1(3333.00) + and remaining values to calculate 3348.00, Previous(ReportItems!MyTextBoxName.Value) + other values)

Now it gives me error: 现在它给我错误:

The Value expression for the textrun 'Amount8.Paragraphs[0].TextRuns[0]' uses an aggregate function on a report item. textrun'Amount8.Paragraphs [0] .TextRuns [0]'的Value表达式在报表项上使用聚合函数。 Aggregate functions can be used only on report items contained in page headers and footers. 汇总功能只能用于页面页眉和页脚中包含的报表项。

I searched over different forums and found out that I can't use ReportItems in this scenario. 我搜索了不同的论坛,发现在这种情况下不能使用ReportItems。 So, what should I do? 所以我该怎么做?

I know my scenario is complicated and its more complicated to explain it but I tried my best. 我知道我的情况很复杂,解释起来也比较复杂,但是我尽了最大的努力。 Please tell me any solution you have. 请告诉我您有什么解决方案。

尝试上一个( 复制MyTextboxName中使用的表达式

You can use Lag function in your SQL Statement to get to previous value. 您可以在SQL语句中使用Lag函数来获取先前的值。

SELECT Field1, Lag(Field1,1,NULL) OVER(PARTITION BY .... ORDER BY ....)
FROM Table1..... 

Here are couple of articles to help you understand Lag in Detail 以下几篇文章可帮助您详细了解滞后

Intro to Lead and Lag By Pinal Dave Pinal Dave简介《领先与落后》

Lead and Lag function article in DatabaseJournal DatabaseJournal中的Lead and Lag函数文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SSRS 布局与报表生成器不同 - SSRS Layout is not same as Report builder 如何将ssrs报表的列中具有不同值的每个单元格链接到不同的报表 - how to link a each cell with different value in a column in a ssrs report to different report 与上述值相同时,SSRS明细单元为空 - SSRS detail cell empty when same value as the one above SSRS 报表生成器计算字段与 SQL 表(属性值) - SSRS Report Builder calculated fields with SQL table (attribute-value) 我们如何在带有行列分组的SSRS表中包括2个数据集 - How can we include 2 datasets in SSRS table with row and column grouping SSRS Report Builder - 获取表中数据更新的日期时间? - SSRS Report Builder - Get the date time when the data in the table is updated? 如何在SSRS报表生成器中创建一行而不是一列的子组? - How can I create a child group in SSRS Report Builder that is a row, not a column? SSRS Report Builder 3.0我可以为表名使用参数吗? - SSRS Report Builder 3.0 Can I use a parameter for a table name? 参数是否可以具有来自不同数据集的值SSRS报表生成器 - Can a parameter have value from different datasets SSRS report builder 如何在SSRS 2008r2中将第n行字段转换为图像-Report Builder 3 - How can i get the nth row field into image in SSRS 2008r2 - Report Builder 3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM