如果性别在SSR中等于男性和女性,则如何写出两个表达式计算值的总和?
我有了SQL查询,在性别专栏内有三个值 - 男性,女性,其他,另一栏,带有学校名称,而没有学生。 因此,在运行了此查询结果后看起来像这样---
校园 | 性别 | 求婚者 |
---|---|---|
XYZ | XYZ男性 | 12 |
XYZ | 女性 | 13 |
XYZ | 其他 | 1 |
ABC | 男性 | 22 |
ABC 22 ABC | 女性 | 10 |
ABC | 其他 | 2 |
我在SSRS报告中在矩阵中显示此查询像这个
校名 | 男性 | 男性 | 其他 |
---|---|---|---|
XYZ | 13 | 12 | 1 |
ABC | 10 | 22 | 2 |
现在我的报告中,我希望在“另一列”旁边添加另一列列,该列将是“ M and f”的“总计”,这将显示为男性和男性总和女性
学校 | 名称女性 | 男性 | 其他 | 总体形式& f |
---|---|---|---|---|
xyz | 13 | 12 | 1 | 25(男性 +女) |
ABC | 10 | 22 | 2 | 32(男性 +女性) |
我想知道我应该写的是什么表达来获得上述结果,以获取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 ---
SchoolName | Gender | NoOfStudents |
---|---|---|
xyz | Male | 12 |
xyz | Female | 13 |
xyz | Other | 1 |
abc | Male | 22 |
abc | Female | 10 |
abc | Other | 2 |
I am displaying this query in SSRS report with the help of matrix so my report looks like this
SchoolName | Female | Male | Other |
---|---|---|---|
xyz | 13 | 12 | 1 |
abc | 10 | 22 | 2 |
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
SchoolName | Female | Male | Other | TotalForM&F |
---|---|---|---|---|
xyz | 13 | 12 | 1 | 25 (Male + Female) |
abc | 10 | 22 | 2 | 32 (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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要首先确定是否需要包含该行,然后将文本框架内的值总结,以便类似的东西应该有效
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