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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

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
1 ACCEPTED SOLUTION
FrankAT
Community Champion
Community Champion

Hi @Anonymous 

take a look at the following solution:

 

06-05-_2021_15-41-18.png

 

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)

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks @FrankAT and @amitchandak for your tips and help!

Cheers

FrankAT
Community Champion
Community Champion

Hi @Anonymous 

take a look at the following solution:

 

06-05-_2021_15-41-18.png

 

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)

amitchandak
Super User
Super User

@Anonymous , Try a new column like

 

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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