Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Daily average in calculated column

Hi Community,

I'm trying to find a way to calculate a daily average of a hourly prices of a certain market on historic series of 5 years. I need it in a column once I need to take that figures for a further join table.

The data is in this "Sample Table":

DatePrice
2021-05-065
2021-05-063
2021-05-061
2021-05-061
2021-05-062
2021-05-052
2021-05-053
2021-05-051
2021-05-054
2021-05-055

 

And the desired output is this format:

DatePriceDaily avg
2021-05-0652.4
2021-05-0632.4
2021-05-0612.4
2021-05-0612.4
2021-05-0622.4
2021-05-0523
2021-05-0533
2021-05-0513
2021-05-0543
2021-05-0553

 

I'm trying to use:

Daily Avg = 

calculate(AVERAGE("Sample Table"[Price]),"Sample Table"[Date]), but output is the hourly price for each row, instead of the average.
 
Any clue on this, please?
 
Thanks in advance.
 
Best regards
  • Hi Anonymous 

    take a look at the following solution:

     

     

    Average by Day = 
    CALCULATE ( AVERAGE ( 'Table'[Price] ), ALLEXCEPT ( 'Table', 'Table'[Date] ) )
    

     

    With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
    FrankAT (Proud to be a Datanaut)

3 Replies

  • FrankAT's avatar
    FrankAT
    Community Champion

    Hi Anonymous 

    take a look at the following solution:

     

     

    Average by Day = 
    CALCULATE ( AVERAGE ( 'Table'[Price] ), ALLEXCEPT ( 'Table', 'Table'[Date] ) )
    

     

    With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
    FrankAT (Proud to be a Datanaut)

  • Anonymous , Try a new column like

     

    averageX(filter(Table, [Date] =earlier([Date])),[Price])