如果性别在SSR中等于男性和女性,则如何写出两个表达式计算值的总和?

发布于 2025-01-27 04:53:19 字数 1358 浏览 2 评论 0原文

我有了SQL查询,在性别专栏内有三个值 - 男性,女性,其他,另一栏,带有学校名称,而没有学生。 因此,在运行了此查询结果后看起来像这样---

校园性别求婚者
XYZXYZ男性12
XYZ女性13
XYZ其他1
ABC男性22
ABC 22 ABC女性10
ABC其他2

我在SSRS报告中在矩阵中显示此查询像这个

校名男性男性其他
XYZ13121
ABC10222

现在我的报告中,我希望在“另一列”旁边添加另一列列,该列将是“ M and f”的“总计”,这将显示为男性和男性总和女性

学校名称女性男性其他总体形式& f
xyz1312125(男性 +女)
ABC1022232(男性 +女性)

我想知道我应该写的是什么表达来获得上述结果,以获取column totalform& f?

我试过写这样的东西= iif(fields!gens.value,例如“男性”,fields!noofstudent.value,0) + iif(fields!gender.value,例如“女性”,fields!noofstudent.value,0)

I have got the sql query where I have three values inside Gender column - Male, Female, Other, another column with school name, and no of student.
So after running this query result looks like this ---

SchoolNameGenderNoOfStudents
xyzMale12
xyzFemale13
xyzOther1
abcMale22
abcFemale10
abcOther2

I am displaying this query in SSRS report with the help of matrix so my report looks like this

SchoolNameFemaleMaleOther
xyz13121
abc10222

Now in my report I want another column added next to the "Other column" which will be "Total for M and F" which will show value which is sum of Male and Female

SchoolNameFemaleMaleOtherTotalForM&F
xyz1312125 (Male + Female)
abc1022232 (Male + Female)

I want to know what expression I should write to get the above result for column TotalForM&F?

I have tried writing something like this =IIf(Fields!Gender.Value Like "Male", Fields!NoOfStudent.Value, 0) + IIf(Fields!Gender.Value Like "Female", Fields!NoOfStudent.Value, 0)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔一刀 2025-02-03 04:53:19

您需要首先确定是否需要包含该行,然后将文本框架内的值总结,以便类似的东西应该有效

=SUM(
    IIF(
        Fields!Gender.Value = "Male" OR Fields!Gender.Value = "Female",
        Fields!NoOfStudent.Value,
        0
        )
    )

You need to first determine if the row needs to be included and then sum the values within the scope of the textbox so something like this should work

=SUM(
    IIF(
        Fields!Gender.Value = "Male" OR Fields!Gender.Value = "Female",
        Fields!NoOfStudent.Value,
        0
        )
    )
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文