是否有 Power Bi Dax 公式来显示基于多个条件的结果?

Is there a Power Bi Dax formula to show a result based on multiple conditions?

我有一个 Table,其中包含以下列:

|       Feature       |       Date       |    Update | hours|
|---------------------|------------------|-----------|------|
|General              |2018-10-02        |V1         |0     |
|General              |2018-10-02        |V1         |0     |
|General              |2018-10-02        |V1         |0     |
|General              |2018-10-02        |V1         |0     |
|General              |2018-10-02        |V1         |0     |
|PvP                  |2018-10-02        |V1         |3     |
|PvP                  |2018-10-02        |V1         |2     |
|PvP                  |2018-10-02        |V1         |1     |
|PvP                  |2018-10-02        |V1         |1     |
|General              |2018-10-02        |V1         |0     |
|General              |2018-10-02        |V1         |7     |
|General              |2018-10-02        |V1         |0     |
|General              |2018-10-02        |V1         |0     |
|Visual               |2018-10-02        |V1         |7     |
|General              |2018-10-15        |V1         |0     |
|General              |2018-10-15        |V1         |0     |
|General              |2018-10-15        |V1         |0     |
|Visual               |2018-10-15        |V1         |7     |
|Visual               |2018-10-15        |V1         |2     |
|General              |2018-10-16        |V1         |1     |

使用此示例,我想添加一个自定义列,该列可以计算 运行 根据以下条件为每个功能执行的次数:

Calculate the sum of minutes based on feature for each day and: For example if today's sum is higher than yesterday's, count as 1 run else count as zero.

下面是一个例子

|       Feature       |       Date       |    Update | hours|No of runs|
|---------------------|------------------|-----------|------|----------|
|General              |2018-10-02        |V1         |0     |1
|General              |2018-10-02        |V1         |0     |1
|General              |2018-10-02        |V1         |0     |1
|General              |2018-10-02        |V1         |0     |1
|General              |2018-10-02        |V1         |0     |1
|PvP                  |2018-10-02        |V1         |3     |1
|PvP                  |2018-10-02        |V1         |2     |1
|PvP                  |2018-10-02        |V1         |1     |1
|PvP                  |2018-10-02        |V1         |1     |1
|General              |2018-10-02        |V1         |0     |1
|General              |2018-10-02        |V1         |7     |1
|General              |2018-10-02        |V1         |0     |1
|General              |2018-10-02        |V1         |0     |1
|Visual               |2018-10-02        |V1         |7     |1
|General              |2018-10-15        |V1         |0     |0
|General              |2018-10-15        |V1         |0     |0
|General              |2018-10-15        |V1         |0     |0
|Visual               |2018-10-15        |V1         |7     |1
|Visual               |2018-10-15        |V1         |2     |1
|General              |2018-10-16        |V1         |1     |1

每个功能的 运行 计数器应该从 1 开始。

到目前为止,我已尝试使用以下公式,但它提供的信息不正确:

No_of_runs = CALCULATE(COUNTA('table'[Feature]),Filter('Table','Table'[Feature]=EARLIER('Table'[Feature]) && 'Table'[Date] > EARLIER('Table'[Date] && 'Table'[Time Invested(hours)] > Earlier('Table'[Time Invested(hours)])))

不确定我是否完全理解其中的逻辑,但请尝试将其作为计算列:

No_of_runs = 
VAR DateToday = 
    Table1[Date]
VAR MinutesToday = 
    CALCULATE ( 
        SUM ( Table1[Time Invested (hours)] ),
        FILTER ( 
            ALLEXCEPT ( Table1, Table1[Feature] ),
            Table1[Date] = DateToday
        )
    )
VAR MinutesYesterday = 
    CALCULATE ( 
        SUM ( Table1[Time Invested (hours)] ),
        FILTER ( 
            ALLEXCEPT ( Table1, Table1[Feature] ),
            Table1[Date] = DateToday - 1
        )
    )
RETURN 
    IF ( 
        MinutesToday > MinutesYesterday,
        1,
        0
    )

编辑:这是一个有效的示例 PBIX 文件; https://pwrbi.com/so_55588315/