在C#reportviewer中汇总一列 [英] Sum a column in C# reportviewer
问题描述
我想在组页脚中总结一列。
该列计算每个客户当月的收入。
每个客户的收入按以下表达式计算:
I am trying to sum a column in a group footer.
The column calculates the revenue made from each customer for the month.
The revenue for each customer gets calculated by the following expression:
=Switch(Fields!currency.Value = "US $",
Switch(
Fields!RatePer.Value = "Load", Count(Fields!tripId.Value) * Fields!rate.Value,
Fields!RatePer.Value = "Ton", Sum(Fields!tonnage.Value) * Fields!rate.Value,
Fields!RatePer.Value = "Litre", Sum(Fields!tonnage.Value) * Fields!rate.Value,
Fields!RatePer.Value = "Kilogram", Sum(Fields!tonnage.Value) * Fields!rate.Value
))
如果费率是美元和每个负载,它按负载数量*费率计算收入。
如果费率是每吨,则按吨数*费率计算收入。
.rdlc文件只显示为«Expr»因此添加总计功能不起作用。
如何汇总列底部的总收入?
请帮助!
我尝试过:
我试过用过表达式中的SUM函数但它无法正常工作
If the rate is USD and per Load it calculates the revenue by number of loads * rate.
If the rate is per ton it calculates the revenue by tonnage * rate.
The .rdlc file just shows it as «Expr» so the "Add total" function does not work.
How do I sum the total revenue at the bottom of the column?
Please help!
What I have tried:
I have tried using the SUM function in the expression but it cannot work that way
推荐答案
,
Switch(
Fields!RatePer.Value = 加载,Count(Fields!tripId.Value)* Fields!rate.Value,
Fields!RatePer.Value = Ton,Sum(Fields!tonnage.Value)* Fields !rate.Value,
Fields!RatePer.Value = 升,Sum(Fields!tonnage.Value)* Fields!rate.Value,
Fields!RatePer.Value = Kilogram,Sum(Fields!tonnage.Value)* Fields!rate.Value
))
", Switch( Fields!RatePer.Value = "Load", Count(Fields!tripId.Value) * Fields!rate.Value, Fields!RatePer.Value = "Ton", Sum(Fields!tonnage.Value) * Fields!rate.Value, Fields!RatePer.Value = "Litre", Sum(Fields!tonnage.Value) * Fields!rate.Value, Fields!RatePer.Value = "Kilogram", Sum(Fields!tonnage.Value) * Fields!rate.Value ))
如果费率是美元和每个负载,它按负载数计算收入*价格。
如果费率是每吨,它按吨数*费率计算收入。
.rdlc文件只显示为« Expr»所以添加总计功能不起作用。
如何汇总列底部的总收入?
请帮忙!
我的尝试:
我有尝试在表达式中使用SUM函数,但它无法正常工作
If the rate is USD and per Load it calculates the revenue by number of loads * rate.
If the rate is per ton it calculates the revenue by tonnage * rate.
The .rdlc file just shows it as «Expr» so the "Add total" function does not work.
How do I sum the total revenue at the bottom of the column?
Please help!
What I have tried:
I have tried using the SUM function in the expression but it cannot work that way
与您的要求相同。
参考:
Microsoft报表查看器中的总和值 [ ^ ]
如果你喜欢这个解决方案请回复。
Same like your requirement.
Reference:
Sum Values in Microsoft Report Viewer[^]
if you like the solution please give a response.
这篇关于在C#reportviewer中汇总一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!