cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Anonymous
Not applicable

## Average of Measure

I am working on a sensor data to find the average sound of each working hour and working days for a month, for example, the average sound_mean of 9 o'clock for 30 days.

I can filter the working hours using a page-level filter...

Example:
Date              Hour   sound-mean
2018-09-01    08       15
2018-09-02    08       52
2018-09-03    08       150

.

.

.
2018-09-01    09       10
2018-09-02    09       20
2018-09-03    09       25
2018-09-04    09       50
To get the avg of 00:00, first I need to sum all of the sound_mean that happened at 00:00 for each day and then perform the avg.
So, 08= avg(15+52+150+......)

09=avg(10+20+25+50+...)

Thanks

2 ACCEPTED SOLUTIONS
Employee

Hi @Anonymous,

Based on my tets, you could refer to below formula:

`Measure = CALCULATE(AVERAGE(Table1[sound-mean]),FILTER('Table1','Table1'[Hour]=MAX('Table1'[Hour])))`

Result:

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

I adjusted the formula like below, and it works fine.

`Measure = CALCULATE(AVERAGE(Table1[sound-mean]),FILTER('Table1','Table1'[Hour]=MAX('Table1'[Hour])&&WEEKDAY('Table1'[Date];2)<=5))`

6 REPLIES 6
Employee

Hi @Anonymous,

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

The first solution gives me the correct results, but the second one doesn't work correctly it still gives me results for weekends and shows blank values for some weekdays.

Anonymous
Not applicable

I adjusted the formula like below, and it works fine.

`Measure = CALCULATE(AVERAGE(Table1[sound-mean]),FILTER('Table1','Table1'[Hour]=MAX('Table1'[Hour])&&WEEKDAY('Table1'[Date];2)<=5))`

Employee

Hi @Anonymous,

Based on my tets, you could refer to below formula:

`Measure = CALCULATE(AVERAGE(Table1[sound-mean]),FILTER('Table1','Table1'[Hour]=MAX('Table1'[Hour])))`

Result:

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

I don't understand what Max function does in this formula, how can I filter the working days(Monday to Friday?

Employee

Hi @Anonymous,

You could modify the formula as below:

`Measure = CALCULATE(AVERAGE(Table1[sound-mean]),FILTER('Table1','Table1'[Hour]=MAX('Table1'[Hour])&&WEEKDAY('Table1'[Date])<=5))`

Result:

Regards,

Daniel He

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

Announcements

#### Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors