简体   繁体   English

如何在ssrs报表中从sql设置第一行值?

[英]How do I set 1st row value from sql in ssrs report?

I'm working on SSRS report. 我正在研究SSRS报告。

There are two main fields CurrentMV and PreviousMV both are having there different formulas but I'm taking PreviousMV as a value of CurrentMV using =Previous(Sum(Fields!CurrentMV.Value)) 有两个主要字段CurrentMVPreviousMV都有不同的公式,但是我使用=Previous(Sum(Fields!CurrentMV.Value))将PreviousMV作为CurrentMV的值。

Now How can I set 1st field only from sql and rest of other as it is coming from expression? 现在,如何仅从sql设置其他字段,而其余的其他字段则来自表达式呢?

Because of I'm using Previous function 1st value is always coming null :( 由于我使用的是Previous function第一个值始终为null :(

I have the field in reporting proc which can give me the values but How can I set both 1st values as well as Previous function ? 我在报告过程中具有可以给我值的字段,但是如何设置第一个值和Previous function

在此处输入图片说明

Using Ian posts in answer But , I want to display only 1st field from Sum(Fields!PreviousMV.Value) and all preceding values by using Previous(Sum(Fields!CurrentMV.Value)) 使用Ian在回答职位,但,我想只显示1st fieldSum(Fields!PreviousMV.Value)和所有前面用数值Previous(Sum(Fields!CurrentMV.Value))

I tried like following and getting syntax error: 我尝试像以下并获取语法错误:

=First(Sum(Fields!PreviousMV.Value)) ,Previous(Sum(Fields!CurrentMV.Value)) 

You can explicitly check for NULL values: 您可以显式检查NULL值:

=IIf(IsNothing(Previous(Sum(Fields!CurrentMV.Value)))
    , Sum(Fields!PreviousMV.Value)
    , Previous(Sum(Fields!CurrentMV.Value)))

Since there are no Previous groups for the first group, this will return NULL for the first group, and hence the above expression will work for you. 由于第一组没有Previous组,因此第一组将返回NULL,因此上面的表达式将对您有用。

Here is a simple report that uses the expression. 这是使用该表达式的简单报告。

Data: 数据:

在此处输入图片说明

Report: 报告:

在此处输入图片说明

The expression value is the one above. 表达式值是上面的值。

Result: 结果:

在此处输入图片说明

You can see it's picking up the values as intended. 您可以看到它正在按预期拾取值。

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

相关问题 如何在SQL Report Server(SSRS)上设置空闲超时 - How do I set idle timeout on SQL Report server (SSRS) Oracle:如何按行中的第一个值分组? - Oracle: how to group by 1st value in row? 如何连接两个SQL表,将第二个表中的值放入第一个表中的列? - How can I join two SQL tables, putting a value from the 2nd table into a column in the 1st? 如果我希望将每月的1号降为T-SQL的1号周,该如何编写查询 - How do I write query if I want 1st day of the month falls in 1st week in T-SQL 如何从第n行到第1行的表中选择数据集 - How to select set of data from a table from nth row to 1st row SQL Server:从同一列中具有匹配值的第一行之后的列中选择所有行 - SQL Server : select all rows from a column after the 1st row with matching value from the same column 如何根据第二个值计算第一列值(其中重复第一列值) - how do I count 1st column values against the second value(in which 1 st column values are repeated) SQL-如何通过将当前行与第一行进行比较来计算天数? - SQL - How can I count days by comparing current row to the 1st row? T-SQL从第一个选择的值在第二个选择联合的每一行 - T-SQL Value from 1st select on each row in 2nd select of a union all 如何在另一个表中选择具有相同值的SQL表中的第一行和第二行实例? - How to select 1st and 2nd row instance in SQL table having the same value in another table?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM