我有一份报告,要求统计事件发生的天数。我创建了一个计算字段,以清除日期:
<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:t="sap.ui.table"
controllerName="ariba.so.kaaguidedassistance.controller.GuidedAssistance" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:l="sap.ui.layout">
<Page title="Guided Assistance Flow Page">
<content>
<Toolbar id="toolbar1">
<Button text="update" press="onSubmit"></Button>
<Button text="add Guided Assistance QA" press="onAddGAQA"></Button>
<Button text="add Guided Assistance Keywords QA" press="onAddGAKQA"></Button>
<Button text="delete" press="onNavigateDelete"></Button>
<ToolbarSpacer/>
<ToolbarSpacer/>
</Toolbar>
<t:Table id="GAQA" rows="{guidedAssistanceGA>/data}" title="Guided Assistance QA" selectionMode="MultiToggle" visibleRowCount="7">
<t:Column width="11rem">
<Label text="ID"/>
<t:template>
<Label text="{guidedAssistanceGA>ID}"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="value_long"/>
<t:template>
<TextArea id="value_long" value="{guidedAssistanceGA>value_long}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Type"/>
<t:template>
<TextArea id="type" value="{guidedAssistanceGA>Type}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Action"/>
<t:template>
<TextArea id="Action" value="{guidedAssistanceGA>Action}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Button1"/>
<t:template>
<TextArea id="Button1" value="{guidedAssistanceGA>Button1}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Button2"/>
<t:template>
<TextArea id="Button2" value="{guidedAssistanceGA>Button2}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Button3"/>
<t:template>
<TextArea id="Button3" value="{guidedAssistanceGA>Button3}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Button4"/>
<t:template>
<TextArea id="Button4" value="{guidedAssistanceGA>Button4}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Button5"/>
<t:template>
<TextArea id="Button5" value="{guidedAssistanceGA>Button5}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Button6"/>
<t:template>
<TextArea id="Button6" value="{guidedAssistanceGA>Button6}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Active_Flag"/>
<t:template>
<TextArea id="Active_Flag" value="{guidedAssistanceGA>Active_Flag}" width="100%"/>
</t:template>
</t:Column>
</t:Table>
<Toolbar id="toolbar2">
<ToolbarSpacer/>
<ToolbarSpacer/>
</Toolbar>
<t:Table id="GAKQA" rows="{guidedAssistanceGAK>/data}" title="Guided Assistance Keywords QA" selectionMode="MultiToggle" visibleRowCount="7">
<t:Column width="11rem">
<Label text="Flow_ID"/>
<t:template>
<Label text="{guidedAssistanceGAK>Flow_ID}"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Keywords"/>
<t:template>
<TextArea id="Keywords" value="{guidedAssistanceGAK>Keywords}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Intersection1"/>
<t:template>
<TextArea id="Intersection1" value="{guidedAssistanceGAK>Intersection1}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Intersection2"/>
<t:template>
<TextArea id="Intersection2" value="{guidedAssistanceGAK>Intersection2}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Logic_Group"/>
<t:template>
<TextArea id="Logic_Group" value="{guidedAssistanceGAK>Logic_Group}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Logic_Order"/>
<t:template>
<TextArea id="Logic_Order" value="{guidedAssistanceGAK>Logic_Order}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="Points"/>
<t:template>
<TextArea id="Points" value="{guidedAssistanceGAK>Points}" width="100%"/>
</t:template>
</t:Column>
<t:Column width="11rem">
<Label text="ID"/>
<t:template>
<Label text="{guidedAssistanceGAK>ID}"/>
</t:template>
</t:Column>
</t:Table>
</content>
</Page>
</mvc:View>
通过将其放置在CountDistinct表达式中,每一行显示该事件发生的正确天数。
但是,我需要将这些结果加到每个行组的总数中。我尝试使用
=IIF(Fields!ID_ACW.Value > 0, Fields!CallDate.Value, Nothing)
和
=Sum(CountDistinct(=IIF(Fields!ID_ACW.Value > 0, Fields!CallDate.Value, Nothing)))
,但都不能给我正确的总数。我有什么想念的吗?或者可以添加一个表达式来计算每行的总值吗?
答案 0 :(得分:0)
我能够通过将行组的值添加到“计算字段”中的日期来使其工作,如下所示:
=IIF(Fields!ID_ACW.Value > 0, Fields!CallDate.Value & " " & Fields!CallHour.Value, Nothing)
现在我可以使用了 ''' CountDistinct(ACWDay) ''' 并获得所有行组的正确总计。
有没有更清洁的方法可以做到这一点?
答案 1 :(得分:0)
这是从内存中提取的,因此可能不是100%,但是您应该了解一下...
=Sum(
CountDistinct(=IIF(Fields!ID_ACW.Value > 0, Fields!CallDate.Value, Nothing), "YourRowGroupName")
)
基本上,您需要在每个行组中进行CountDistinct,然后对结果求和。