0

我有一个实体表示员工每半天(上午和下午)的缺勤情况。该实体有 4 个相关字段:员工姓名(另一个自定义实体)、缺勤原因(假期、加班费、带薪休假、允许休假……总共 11 个)、缺勤日期以及是否是 AM 或PM 缺席(使用 2 个值的下拉列表)。如果员工全天缺勤,则制作 2 条记录,1 条用于上午,1 ​​条用于下午。

我现在必须制作一个显示以下内容的图表:

对每位员工的所有缺勤情况进行分组(5名缺勤员工为5组);根据缺勤原因对特定员工的所有缺勤进行分组(有 2 次不同缺勤的员工在其组中获得 2 个相邻的列);显示的数据是所有缺勤的计数,按日期分组(2 次缺勤,凌晨 1 点和下午 1 点,在同一日期应计为 1 次缺勤,而不是 2 次)。实际上,我需要计算唯一日期。

我设法制作了一个基本图表,其中包含员工和缺勤原因组。但是,我无法弄清楚如何计算唯一日期。

到目前为止我得到的是:

<visualization>
  <visualizationid>{CA31385D-FE63-E311-A895-005056A03018}</visualizationid>
  <name>Datum afwezigheid bij personeelsfiche en reden van afwezigheid</name>
  <primaryentitytypecode>acm_tijdindeling</primaryentitytypecode>
  <datadescription>
    <datadefinition>
      <fetchcollection>
        <fetch mapping="logical" aggregate="true">
          <entity name="acm_tijdindeling">
            <attribute groupby="true" alias="group_personeelsfiche" name="acm_personeelsfiche" />
            <attribute alias="count_datumafwezigheid" name="acm_datumafwezigheid" aggregate="count" />
            <attribute groupby="true" alias="group_redenvanafwezigheid" name="acm_redenvanafwezigheid" />
          </entity>
        </fetch>
      </fetchcollection>
      <categorycollection>
        <category alias="group_personeelsfiche">
          <measurecollection>
            <measure alias="count_datumafwezigheid" />
          </measurecollection>
        </category>
      </categorycollection>
    </datadefinition>
  </datadescription>
  <presentationdescription>
    <Chart Palette="None" PaletteCustomColors="55,118,193; 197,56,52; 149,189,66; 117,82,160; 49,171,204; 255,136,35; 97,142,206; 209,98,96; 168,203,104; 142,116,178; 93,186,215; 255,155,83">
      <Series>
        <Series ChartType="Column" IsValueShownAsLabel="True" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PointWidth=0.75, MaxPixelPointWidth=40"></Series>
      </Series>
      <ChartAreas>
        <ChartArea BorderColor="White" BorderDashStyle="Solid">
          <AxisY LabelAutoFitMinFontSize="8" TitleForeColor="59, 59, 59" TitleFont="{0}, 10.5px" LineColor="165, 172, 181" IntervalAutoMode="VariableCount">
            <MajorGrid LineColor="239, 242, 246" />
            <MajorTickMark LineColor="165, 172, 181" />
            <LabelStyle Font="{0}, 10.5px" ForeColor="59, 59, 59" />
          </AxisY>
          <AxisX LabelAutoFitMinFontSize="8" TitleForeColor="59, 59, 59" TitleFont="{0}, 10.5px" LineColor="165, 172, 181" IntervalAutoMode="VariableCount">
            <MajorTickMark LineColor="165, 172, 181" />
            <MajorGrid LineColor="Transparent" />
            <LabelStyle Font="{0}, 10.5px" ForeColor="59, 59, 59" />
          </AxisX>
        </ChartArea>
      </ChartAreas>
      <Titles>
        <Title Alignment="TopLeft" DockingOffset="-3" Font="{0}, 13px" ForeColor="59, 59, 59"></Title>
      </Titles>
      <Legends>
        <Legend Alignment="Center" LegendStyle="Table" Docking="right" IsEquallySpacedItems="True" Font="{0}, 11px" ShadowColor="0, 0, 0, 0" ForeColor="59, 59, 59" />
      </Legends>
    </Chart>
  </presentationdescription>
  <isdefault>false</isdefault>
</visualization>

我尝试添加groupby="true" dategrouping="day"count_datumafwezigheid聚合中,但随后出现“无效 XML”错误。

4

2 回答 2

1

这是有关如何计算独特项目的链接http://crmchartguy.wordpress.com/2013/12/12/count-distinct-or-unique-items-in-ms-crm-charts/

于 2014-02-27T16:31:52.660 回答
0

我曾经遇到过类似的问题 - 我不确定是否可以聚合 DateTime - 请参阅线程: Fetch DateTime CRM 2011

于 2014-01-02T17:22:32.867 回答