查找两个日期列之间的平均值 (SAP Business Objects)

Finding the average between two date columns (SAP Business Objects)

我希望 table 使用 SAP Business Objects 按部门显示员工的平均任期。例如,市场部的所有员工都有开始和结束日期;我首先用开始日期减去后者以获得任期天数。问题的起点是找到部门的平均任期天数并将其显示在没有员工详细信息的 table 中,然后将部门合并到办公室。

我试过合并部分和创建变量。

=平均(天数([开始日期];[结束日期]))

创建一个变量来找到两个日期之间的平均值定义正确,但是一旦我将公式合并到 table 中,就不会出现任何值。

根据我了解您的情况,我模拟了一个电子表格,并基于该电子表格创建了 Web Intelligence 报告。

<!DOCTYPE html>
<html>
 <head>
  <meta charset="UTF-8">
   <title>Excel To HTML using codebeautify.org</title>
  </head>
  <body>
   <b>
    <u>Sheet Name</u> :- Sheet1
   </b>
   <hr>
    <table cellspacing=0 border=1>
     <tr>
      <td style=min-width:50px>Employee ID</td>
      <td style=min-width:50px>First Name</td>
      <td style=min-width:50px>Last Name</td>
      <td style=min-width:50px>Begin Date</td>
      <td style=min-width:50px>End Date</td>
      <td style=min-width:50px>Dept ID</td>
      <td style=min-width:50px>Office ID</td>
     </tr>
     <tr>
      <td style=min-width:50px>1</td>
      <td style=min-width:50px>Atticus</td>
      <td style=min-width:50px>Aldridge</td>
      <td style=min-width:50px>05-07-19</td>
      <td style=min-width:50px>07-10-19</td>
      <td style=min-width:50px>1</td>
      <td style=min-width:50px>1</td>
     </tr>
     <tr>
      <td style=min-width:50px>2</td>
      <td style=min-width:50px>Rose</td>
      <td style=min-width:50px>Aldridge</td>
      <td style=min-width:50px>04-16-19</td>
      <td style=min-width:50px>06-26-19</td>
      <td style=min-width:50px>1</td>
      <td style=min-width:50px>1</td>
     </tr>
     <tr>
      <td style=min-width:50px>3</td>
      <td style=min-width:50px>Thomas</td>
      <td style=min-width:50px>Barrow</td>
      <td style=min-width:50px>01-01-19</td>
      <td style=min-width:50px>08-07-19</td>
      <td style=min-width:50px>2</td>
      <td style=min-width:50px>1</td>
     </tr>
     <tr>
      <td style=min-width:50px>4</td>
      <td style=min-width:50px>Anna</td>
      <td style=min-width:50px>Bates</td>
      <td style=min-width:50px>02-12-19</td>
      <td style=min-width:50px>09-04-19</td>
      <td style=min-width:50px>2</td>
      <td style=min-width:50px>1</td>
     </tr>
     <tr>
      <td style=min-width:50px>5</td>
      <td style=min-width:50px>John</td>
      <td style=min-width:50px>Bates</td>
      <td style=min-width:50px>01-22-19</td>
      <td style=min-width:50px>08-21-19</td>
      <td style=min-width:50px>2</td>
      <td style=min-width:50px>1</td>
     </tr>
     <tr>
      <td style=min-width:50px>6</td>
      <td style=min-width:50px>Phyllis</td>
      <td style=min-width:50px>Baxter</td>
      <td style=min-width:50px>07-16-18</td>
      <td style=min-width:50px></td>
      <td style=min-width:50px>3</td>
      <td style=min-width:50px>1</td>
     </tr>
     <tr>
      <td style=min-width:50px>7</td>
      <td style=min-width:50px>Tom</td>
      <td style=min-width:50px>Branson</td>
      <td style=min-width:50px>03-26-19</td>
      <td style=min-width:50px>06-12-19</td>
      <td style=min-width:50px>3</td>
      <td style=min-width:50px>1</td>
     </tr>
     <tr>
      <td style=min-width:50px>8</td>
      <td style=min-width:50px>Charles</td>
      <td style=min-width:50px>Carson</td>
      <td style=min-width:50px>04-16-19</td>
      <td style=min-width:50px>06-26-19</td>
      <td style=min-width:50px>4</td>
      <td style=min-width:50px>1</td>
     </tr>
     <tr>
      <td style=min-width:50px>9</td>
      <td style=min-width:50px>Elsie</td>
      <td style=min-width:50px>Carson</td>
      <td style=min-width:50px>05-07-19</td>
      <td style=min-width:50px>07-10-19</td>
      <td style=min-width:50px>4</td>
      <td style=min-width:50px>1</td>
     </tr>
     <tr>
      <td style=min-width:50px>10</td>
      <td style=min-width:50px>Richard</td>
      <td style=min-width:50px>Clarkson</td>
      <td style=min-width:50px>08-10-18</td>
      <td style=min-width:50px>03-22-19</td>
      <td style=min-width:50px>4</td>
      <td style=min-width:50px>1</td>
     </tr>
     <tr>
      <td style=min-width:50px>11</td>
      <td style=min-width:50px>Cora</td>
      <td style=min-width:50px>Crawley</td>
      <td style=min-width:50px>01-22-19</td>
      <td style=min-width:50px>05-01-19</td>
      <td style=min-width:50px>1</td>
      <td style=min-width:50px>2</td>
     </tr>
     <tr>
      <td style=min-width:50px>12</td>
      <td style=min-width:50px>Robert</td>
      <td style=min-width:50px>Crawley</td>
      <td style=min-width:50px>01-01-19</td>
      <td style=min-width:50px></td>
      <td style=min-width:50px>1</td>
      <td style=min-width:50px>2</td>
     </tr>
     <tr>
      <td style=min-width:50px>13</td>
      <td style=min-width:50px>Violet</td>
      <td style=min-width:50px>Crawley</td>
      <td style=min-width:50px>03-05-19</td>
      <td style=min-width:50px></td>
      <td style=min-width:50px>2</td>
      <td style=min-width:50px>2</td>
     </tr>
     <tr>
      <td style=min-width:50px>14</td>
      <td style=min-width:50px>Daisy</td>
      <td style=min-width:50px>Mason</td>
      <td style=min-width:50px>05-02-18</td>
      <td style=min-width:50px>07-13-19</td>
      <td style=min-width:50px>2</td>
      <td style=min-width:50px>2</td>
     </tr>
     <tr>
      <td style=min-width:50px>15</td>
      <td style=min-width:50px>Isobel</td>
      <td style=min-width:50px>Merton</td>
      <td style=min-width:50px>03-26-19</td>
      <td style=min-width:50px>06-12-19</td>
      <td style=min-width:50px>2</td>
      <td style=min-width:50px>2</td>
     </tr>
     <tr>
      <td style=min-width:50px>16</td>
      <td style=min-width:50px>Joseph</td>
      <td style=min-width:50px>Molesley</td>
      <td style=min-width:50px>02-16-18</td>
      <td style=min-width:50px></td>
      <td style=min-width:50px>3</td>
      <td style=min-width:50px>2</td>
     </tr>
     <tr>
      <td style=min-width:50px>17</td>
      <td style=min-width:50px>Andy</td>
      <td style=min-width:50px>Parker</td>
      <td style=min-width:50px>06-21-18</td>
      <td style=min-width:50px>09-15-19</td>
      <td style=min-width:50px>3</td>
      <td style=min-width:50px>2</td>
     </tr>
     <tr>
      <td style=min-width:50px>18</td>
      <td style=min-width:50px>Beryl</td>
      <td style=min-width:50px>Patmore</td>
      <td style=min-width:50px>05-28-19</td>
      <td style=min-width:50px>07-24-19</td>
      <td style=min-width:50px>4</td>
      <td style=min-width:50px>2</td>
     </tr>
     <tr>
      <td style=min-width:50px>19</td>
      <td style=min-width:50px>Bertie</td>
      <td style=min-width:50px>Pelham</td>
      <td style=min-width:50px>04-07-18</td>
      <td style=min-width:50px>06-11-19</td>
      <td style=min-width:50px>4</td>
      <td style=min-width:50px>2</td>
     </tr>
     <tr>
      <td style=min-width:50px>20</td>
      <td style=min-width:50px>Edith</td>
      <td style=min-width:50px>Pelham</td>
      <td style=min-width:50px>03-05-19</td>
      <td style=min-width:50px>05-29-19</td>
      <td style=min-width:50px>4</td>
      <td style=min-width:50px>2</td>
     </tr>
     <tr>
      <td style=min-width:50px>21</td>
      <td style=min-width:50px>Lucy</td>
      <td style=min-width:50px>Smith</td>
      <td style=min-width:50px>05-27-18</td>
      <td style=min-width:50px>08-14-19</td>
      <td style=min-width:50px>3</td>
      <td style=min-width:50px>2</td>
     </tr>
     <tr>
      <td style=min-width:50px>22</td>
      <td style=min-width:50px>Henry</td>
      <td style=min-width:50px>Talbot</td>
      <td style=min-width:50px>03-13-18</td>
      <td style=min-width:50px>05-10-19</td>
      <td style=min-width:50px>3</td>
      <td style=min-width:50px>2</td>
     </tr>
     <tr>
      <td style=min-width:50px>23</td>
      <td style=min-width:50px>Mary</td>
      <td style=min-width:50px>Talbot</td>
      <td style=min-width:50px>02-12-19</td>
      <td style=min-width:50px>05-15-19</td>
      <td style=min-width:50px>3</td>
      <td style=min-width:50px>2</td>
     </tr>
    </table>
    <hr>
    </body>
   </html>

我创建了两个变量,它们的 Qualification 设置为 "Measure"...

Tenure=DaysBetween([Begin Date]; If(IsNull([End Date]);CurrentDate();[End Date]))

Avg Tenure=Average([Tenure])

请注意,如果未定义 结束日期,那么我将从 CurrentDate()[= 中减去 开始日期 33=]。它似乎对我有用...

这对你有用吗?如果没有,我错过了什么?