Forum Discussion

CalvinL's avatar
CalvinL
Helper II
6 years ago
Solved

Average over certain period

Hi all,   Looking to get an average of values between 00:00 to 12:00 for each day.   Sample dataset:   Date   Value 12/02/2020 00:00:00   37  12/02/2020 06:00:00   45 12/02/20...
  • v-zhenbw-msft's avatar
    6 years ago

    Hi CalvinL ,

     

    We can use the Power Query and create a calculate column to meet your requirement.

     

    1. In Power Query Editor, we can use Date only and Time only functions to create two columns.

     

     

    2. Then we can create a calculate columns in data view,

     

    Column = 
    var time1 = TIME(0,0,0)
    var time2 = TIME(12,0,0)
    return
    CALCULATE(AVERAGE('Table'[Value]),FILTER('Table',EARLIER('Table'[Date.1])='Table'[Date.1] && 'Table'[Time]>=time1&&'Table'[Time]<=time2))

     

     

     

    If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?

    BTW, pbix as attached.

     

    Best regards,

     

    Community Support Team _ zhenbw

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.