Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Calculate Sum between two TIMES (Not Dates)

Hi All, I have an issue where I'm trying to find the SUM energy between two times, a departing time and an arrival time. However, when I try to sum using a filter I get nothing. I know the data is...
  • v-yingjl's avatar
    5 years ago

    Hi Anonymous ,

    Looks like you are creating a calculated column, try like this:

    EnergyUse =
    CALCULATE (
        SUM ( 'Table1'[Energy] ),
        FILTER (
            ALL ( Table1 ),
            'Table1'[Time] >= MIN ( 'Table2'[dep] )
                && 'Table1'[Time] <= MIN ( 'Table2'[arr] )
        )
    )
    

    Attached a sample file in the below, hopes to help you.

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.