Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Repeat 24 hours average for each day

Hi all,

First post here.

I’ve gathered the forum and part of Google. I've found similar topics, but I cannot make it work, I’d be grateful for your help.

 

I have an hourly time series in Power BI ('Date' and 'Price').
I need to fill a column ('Daily average') REPEATING each ROW the average of the 24h of that day, the key challenge is to change the average when the day changes.

I’ve been trying different approaches with AVERAGEX, VALUES… but I cannot get to find the solution.

It’s easier to see in this example from Excel: 

The 'Daily average' is the average of the 24 numbers in column 'Price'. 

edejuan_0-1655372245157.png

I'm completely stuck. How could I do it in Power BI (DAX)? 

Thank you very much. 
Best regards, 

Enrique

 

1 ACCEPTED SOLUTION

@Anonymous Soooorry, a huge mistake!!

The correct formula:

 

= CALCULATE(AVERAGE(Prod_ES[Price]), ALLEXCEPT(Prod_ES,Prod_ES[date].[Date]))
 
the first one took into account only the day, but you have a lot of years and  months!
 
BF

View solution in original post

16 REPLIES 16
BeaBF
Super User
Super User

@Anonymous Hi!

 

can you paste the data as a table and not an image?

 

BF

Anonymous
Not applicable

Hi @BeaBF 

Sure! Here you have. Thanks! 

 

DatePriceDaily average
19/05/2022 0:00179,94192,12
19/05/2022 1:00176,27192,12
19/05/2022 2:00177,98192,12
19/05/2022 3:00185,06192,12
19/05/2022 4:00222,33192,12
19/05/2022 5:00235,7192,12
19/05/2022 6:00230,01192,12
19/05/2022 7:00215,94192,12
19/05/2022 8:00198,22192,12
19/05/2022 9:00171,59192,12
19/05/2022 10:00167,02192,12
19/05/2022 11:00163,7192,12
19/05/2022 12:00161,18192,12
19/05/2022 13:00157,14192,12
19/05/2022 14:00157,14192,12
19/05/2022 15:00162,1192,12
19/05/2022 16:00164,54192,12
19/05/2022 17:00182192,12
19/05/2022 18:00220,43192,12
19/05/2022 19:00236,21192,12
19/05/2022 20:00226,03192,12
19/05/2022 21:00213,31192,12
19/05/2022 22:00211,1192,12
19/05/2022 23:00195,98192,12
20/05/2022 0:00189,56201,33
20/05/2022 1:00188201,33
20/05/2022 2:00189,56201,33
20/05/2022 3:00208,62201,33
20/05/2022 4:00226,51201,33
20/05/2022 5:00230,05201,33
20/05/2022 6:00230,72201,33
20/05/2022 7:00224201,33
20/05/2022 8:00204,97201,33
20/05/2022 9:00200,28201,33
20/05/2022 10:00195201,33
20/05/2022 11:00190,07201,33
20/05/2022 12:00180,18201,33
20/05/2022 13:00174201,33
20/05/2022 14:00180,18201,33
20/05/2022 15:00190201,33
20/05/2022 16:00214,92201,33
20/05/2022 17:00225,63201,33
20/05/2022 18:00226,87201,33
20/05/2022 19:00218,03201,33
20/05/2022 20:00205,27201,33
20/05/2022 21:00190,17201,33
20/05/2022 22:00180201,33
20/05/2022 23:00169,27201,33
21/05/2022 0:00169,26180,57
21/05/2022 1:00165,87180,57
21/05/2022 2:00164,84180,57
21/05/2022 3:00164,94180,57
21/05/2022 4:00164,84180,57
21/05/2022 5:00164,85180,57
21/05/2022 6:00166,54180,57
21/05/2022 7:00172,97180,57
21/05/2022 8:00178,82180,57
21/05/2022 9:00174,89180,57
21/05/2022 10:00170,57180,57
21/05/2022 11:00167,45180,57
21/05/2022 12:00164,67180,57
21/05/2022 13:00161,55180,57
21/05/2022 14:00159,33180,57
21/05/2022 15:00164,84180,57
21/05/2022 16:00171,58180,57
21/05/2022 17:00201180,57
21/05/2022 18:00219,32180,57
21/05/2022 19:00228,11180,57
21/05/2022 20:00227,05180,57
21/05/2022 21:00216,42180,57
21/05/2022 22:00214,57180,57
21/05/2022 23:00179,4180,57

 

 

(I'm having problems with posting, maybe my wifi, I've replied a couple of times but don't see my reply)

 

Thanks again

 

@Anonymous You can calculate a column like this:

 

= CALCULATE(AVERAGE(Tabella[Price]), ALLEXCEPT(Tabella, Tabella[Date].[Giorno]))
 
BF
Anonymous
Not applicable

Hi @BeaBF 
Thank you very much for your formula. 

I'm afraid it doesn't work, it returns this: 

 

DatePriceDaily average
(expected result)
BeaBF
19/05/2022 0:00179,94192,1265,94
19/05/2022 1:00176,27192,1265,94
19/05/2022 2:00177,98192,1265,94
19/05/2022 3:00185,06192,1265,94
19/05/2022 4:00222,33192,1265,94
19/05/2022 5:00235,7192,1265,94
19/05/2022 6:00230,01192,1265,94
19/05/2022 7:00215,94192,1265,94
19/05/2022 8:00198,22192,1265,94
19/05/2022 9:00171,59192,1265,94
19/05/2022 10:00167,02192,1265,94
19/05/2022 11:00163,7192,1265,94
19/05/2022 12:00161,18192,1265,94
19/05/2022 13:00157,14192,1265,94
19/05/2022 14:00157,14192,1265,94
19/05/2022 15:00162,1192,1265,94
19/05/2022 16:00164,54192,1265,94
19/05/2022 17:00182192,1265,94
19/05/2022 18:00220,43192,1265,94
19/05/2022 19:00236,21192,1265,94
19/05/2022 20:00226,03192,1265,94
19/05/2022 21:00213,31192,1265,94
19/05/2022 22:00211,1192,1265,94
19/05/2022 23:00195,98192,1265,94
20/05/2022 0:00189,56201,3363,94
20/05/2022 1:00188201,3363,94
20/05/2022 2:00189,56201,3363,94
20/05/2022 3:00208,62201,3363,94
20/05/2022 4:00226,51201,3363,94
20/05/2022 5:00230,05201,3363,94
20/05/2022 6:00230,72201,3363,94
20/05/2022 7:00224201,3363,94
20/05/2022 8:00204,97201,3363,94
20/05/2022 9:00200,28201,3363,94
20/05/2022 10:00195201,3363,94
20/05/2022 11:00190,07201,3363,94
20/05/2022 12:00180,18201,3363,94
20/05/2022 13:00174201,3363,94
20/05/2022 14:00180,18201,3363,94
20/05/2022 15:00190201,3363,94
20/05/2022 16:00214,92201,3363,94
20/05/2022 17:00225,63201,3363,94
20/05/2022 18:00226,87201,3363,94
20/05/2022 19:00218,03201,3363,94
20/05/2022 20:00205,27201,3363,94
20/05/2022 21:00190,17201,3363,94
20/05/2022 22:00180201,3363,94
20/05/2022 23:00169,27201,3363,94
    

@Anonymous no, i've just tried it and it works:

BeaBF_0-1655381638400.png

 

Can you paste your formula?

 

BF

Anonymous
Not applicable

Hi @BeaBF , thanks again for your patiente. 
This is my formula

= CALCULATE(AVERAGE('Tabla'[Price]), ALLEXCEPT('Tabla',Tabla[date].[Day]))
'Day' is in a Hierarchy in 'date'
 

@Anonymous I have redone the formula and it works:

BeaBF_0-1655382379333.png

 

can you paste a screen?

 

BF

Anonymous
Not applicable

Hi @BeaBF , 

Here's a screenshot. I've overlayed in red the expected result. 
I'm scratching my head. I don't understand. 

edejuan_0-1655383666419.png

 

When done in a small dataset, your formula works OK 🙂
Buen when I apply it to the 65k rows model, it doesn't. 
Mystery! 

 

 

@Anonymous The field date is in datetime type, right? uhmmm 

Anonymous
Not applicable

Yes. 

edejuan_0-1655384154936.png

Totally lost here...

 

@Anonymous ok, plan B. Can you send me your pbix? 

Anonymous
Not applicable

Hi @BeaBF, I've sent you a Wetransfer link via private message. 

Thanks for your help!!!

@Anonymous Soooorry, a huge mistake!!

The correct formula:

 

= CALCULATE(AVERAGE(Prod_ES[Price]), ALLEXCEPT(Prod_ES,Prod_ES[date].[Date]))
 
the first one took into account only the day, but you have a lot of years and  months!
 
BF
Anonymous
Not applicable

IT WORKS!!! 

Thank you thank you thank you @BeaBF , you're simply the best!!! 🙂 

Anonymous
Not applicable

Sure! 

Sorry! There you have. 

Thanks!! 

 

 

DatePriceDaily average
19/05/2022 0:00179,94192,12
19/05/2022 1:00176,27192,12
19/05/2022 2:00177,98192,12
19/05/2022 3:00185,06192,12
19/05/2022 4:00222,33192,12
19/05/2022 5:00235,7192,12
19/05/2022 6:00230,01192,12
19/05/2022 7:00215,94192,12
19/05/2022 8:00198,22192,12
19/05/2022 9:00171,59192,12
19/05/2022 10:00167,02192,12
19/05/2022 11:00163,7192,12
19/05/2022 12:00161,18192,12
19/05/2022 13:00157,14192,12
19/05/2022 14:00157,14192,12
19/05/2022 15:00162,1192,12
19/05/2022 16:00164,54192,12
19/05/2022 17:00182192,12
19/05/2022 18:00220,43192,12
19/05/2022 19:00236,21192,12
19/05/2022 20:00226,03192,12
19/05/2022 21:00213,31192,12
19/05/2022 22:00211,1192,12
19/05/2022 23:00195,98192,12
20/05/2022 0:00189,56201,33
20/05/2022 1:00188201,33
20/05/2022 2:00189,56201,33
20/05/2022 3:00208,62201,33
20/05/2022 4:00226,51201,33
20/05/2022 5:00230,05201,33
20/05/2022 6:00230,72201,33
20/05/2022 7:00224201,33
20/05/2022 8:00204,97201,33
20/05/2022 9:00200,28201,33
20/05/2022 10:00195201,33
20/05/2022 11:00190,07201,33
20/05/2022 12:00180,18201,33
20/05/2022 13:00174201,33
20/05/2022 14:00180,18201,33
20/05/2022 15:00190201,33
20/05/2022 16:00214,92201,33
20/05/2022 17:00225,63201,33
20/05/2022 18:00226,87201,33
20/05/2022 19:00218,03201,33
20/05/2022 20:00205,27201,33
20/05/2022 21:00190,17201,33
20/05/2022 22:00180201,33
20/05/2022 23:00169,27201,33

 

Anonymous
Not applicable

Sure @BeaBF ! 

There you have. 

Thanks!! 

 

 

DatePriceDaily average
19/05/2022 0:00179,94192,12
19/05/2022 1:00176,27192,12
19/05/2022 2:00177,98192,12
19/05/2022 3:00185,06192,12
19/05/2022 4:00222,33192,12
19/05/2022 5:00235,7192,12
19/05/2022 6:00230,01192,12
19/05/2022 7:00215,94192,12
19/05/2022 8:00198,22192,12
19/05/2022 9:00171,59192,12
19/05/2022 10:00167,02192,12
19/05/2022 11:00163,7192,12
19/05/2022 12:00161,18192,12
19/05/2022 13:00157,14192,12
19/05/2022 14:00157,14192,12
19/05/2022 15:00162,1192,12
19/05/2022 16:00164,54192,12
19/05/2022 17:00182192,12
19/05/2022 18:00220,43192,12
19/05/2022 19:00236,21192,12
19/05/2022 20:00226,03192,12
19/05/2022 21:00213,31192,12
19/05/2022 22:00211,1192,12
19/05/2022 23:00195,98192,12
20/05/2022 0:00189,56201,33
20/05/2022 1:00188201,33
20/05/2022 2:00189,56201,33
20/05/2022 3:00208,62201,33
20/05/2022 4:00226,51201,33
20/05/2022 5:00230,05201,33
20/05/2022 6:00230,72201,33
20/05/2022 7:00224201,33
20/05/2022 8:00204,97201,33
20/05/2022 9:00200,28201,33
20/05/2022 10:00195201,33
20/05/2022 11:00190,07201,33
20/05/2022 12:00180,18201,33
20/05/2022 13:00174201,33
20/05/2022 14:00180,18201,33
20/05/2022 15:00190201,33
20/05/2022 16:00214,92201,33
20/05/2022 17:00225,63201,33
20/05/2022 18:00226,87201,33
20/05/2022 19:00218,03201,33
20/05/2022 20:00205,27201,33
20/05/2022 21:00190,17201,33
20/05/2022 22:00180201,33
20/05/2022 23:00169,27201,33

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.