我有一个Time列,其中以min为单位,以ssrs为单位,我需要以使其以Day,hour和min为单位的方式获取平均值和输出。 例如,列名是“时间(分钟)”。如何以这样的方式编写表达式,使我们能够以天,小时和分钟为单位获取结果
答案 0 :(得分:2)
假设您的时间列只是一个包含分钟数的整数数据类型,那么类似的事情将起作用。
以下内容基于报告参数进行计算,以使其更易于测试,因此oyu将需要将其换出正确的列名称和聚合。例如如果您将时间列称为MyTime,并且要基于平均值进行计算,则将<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
换成Parameters!MyMins.Value
AVG(Fields!MyTime.Value)
调整输出以适合您的格式要求。...
上面的代码将4455分钟变成字符串“ 3天2小时15分钟”
答案 1 :(得分:0)
输入以下表达式:
=Format(TimeSerial(0,Parameters!MyMins.Value,0),"dd") & " Days "
& Format(TimeSerial(0,Parameters!MyMins.Value,0),"HH") & " Hours "
& Format(TimeSerial(0,Parameters!MyMins.Value,0),"mm") & " Minutes "
或者,创建另一个参数,例如我的时间
=TimeSerial(0,Parameters!MyMins.Value,0)
(通过在列表中将其向下移动,确保在MyMins之后评估此参数) 然后将其放入上面的代码中
=Format(Parameters!MyTime.Value,"dd") & " Days "
& Format(Parameters!MyTime.Value,"HH") & " Hours "
& Format(Parameters!MyTime.Value,"mm") & " Minutes "