【问题标题】:DAX / PowerPivot overlapping of three periods in time三个时间段的 DAX / PowerPivot 重叠
【发布时间】:2017-11-21 18:44:52
【问题描述】:

我正在尝试将事件的有效持续时间计算为计算列,例如: [事件总持续时间] - [与事件重叠的非办公时间] - [办公时间内系统停机时间] 我不知道如何做到这一点

办公时间表:

date - office hours start time - office hours end time - is working day
01/01/2017 - 08:00 am - 08:00 pm - 0
02/01/2017 - 08:00 am - 08:00 pm - 1
...
09/01/2017 - 08:00 am - 08:00 pm - 1
10/01/2017 - 08:00 am - 08:00 pm - 1
11/01/2017 - 08:00 am - 08:00 pm - 1
...

系统停机时间表:

date - system downtime start time - system downtime end time
01/01/2017 - 08:17 am - 9:43 am
10/01/2017 - 7:00 pm - 8:00 pm

事件表:

EventID - start datetime - end datetime - effective duration
1 - 01/01/2017 7:40 am - 01/01/2017 8:40 am - 0; Comment: 0 is because though there was a dowtime of the system overlapping this event, the event itself was during non working day
2 - 09/01/2017 7:40 am - 11/01/2017 11:00 am - 24; Comment: [total duration of event] - [out of office hours overlapping the event] - [system downtime during office hours] = 24 hours
3 - 

我希望此有效持续时间计算列位于 EventsTable 中

正如你所想象的那样,有很多重叠和时间智能正在发生,我就是无法理解这一点。

我正在运行 PowerPivot for Excel 2013

【问题讨论】:

  • 有人吗?我知道这是一个具有挑战性的问题,但它是可行的,不是吗?

标签: excel datetime excel-2013 powerpivot dax


【解决方案1】:

我也在修改这个;这是我对蛮力方法的初步想法:

  1. 制作一个主小时表,其中列出了您的分钟之间的所有小时 数据集中的日期时间和最大日期时间
    1. 将您的停机时间添加到该表中,以将每个小时标记为“向上”/“向下”
    2. 将您的办公时间添加到您的主要工作时间表中,以将每个时间标记为“工作”/“不在办公室”
    3. 在您的小时表中创建一个计算列 valid_hours,如果 "up"&"working" else 0 则为 1
    4. 对于每个事件,您可以在 DAX 中执行以下形式的列公式:

in_scope_event_hours = CALCULATE(SUM(hours_table[valid_hours]),FILTER(hours_table,hours_table[datetime]>=event[start]&&hours_table[datetime]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-13
    相关资源
    最近更新 更多