Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I have some data similar to what is shown below:
| Date | Sample | Value |
| March 20th, 2024 | 1 | 5 |
| March 20th, 2024 | 2 | 6 |
| March 20th, 2024 | 3 | 7 |
| March 20th, 2024 | 4 | 3 |
| March 20th, 2024 | 5 | 4 |
The average of these values is 5, and I want a measure that I can use that shows me the count of values that are +/-1 of that average. The matrix table I would like to show at the end should look like this:
| Date - Sample | Average of Value | Count within 1 of average |
| March 20th, 2024 | 3 | 3 |
| 1 | 5 | 1 |
| 2 | 6 | 1 |
| 3 | 7 | 0 |
| 4 | 3 | 0 |
| 5 | 4 | 1 |
The expression I am using as a measure is:
In Range =
var _average = Calculate(AVERAGE('Data'[VALUE]),REMOVEFILTERS('Data'[Sample]))
var _delta = abs(average('Data'[VALUE])-_average)
var _inRange = CALCULATE(COUNTA('Data'[VALUE]),FILTER('Data',_delta<=1))
return _inRange
| Date - Sample | Value | Count within 1 of average |
| March 20th, 2024 | 3 | 5 |
| 1 | 5 | 1 |
| 2 | 6 | 1 |
| 3 | 7 | 0 |
| 4 | 3 | 0 |
| 5 | 4 | 1 |
Any ideas?
Solved! Go to Solution.
is this ok?
In Range =
var _average = Calculate(AVERAGE('Data'[VALUE]),REMOVEFILTERS('Data'[Sample]))
var _inRange = CALCULATE(COUNTA('Data'[VALUE]),FILTER('Data',abs('Data'[VALUE]-_average)<=1))
return _inRange
is this ok?
In Range =
var _average = Calculate(AVERAGE('Data'[VALUE]),REMOVEFILTERS('Data'[Sample]))
var _inRange = CALCULATE(COUNTA('Data'[VALUE]),FILTER('Data',abs('Data'[VALUE]-_average)<=1))
return _inRange
Sorry - posted too quickly. Tried again, and it worked. Must not have done it right the first time. Thanks!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 9 | |
| 8 | |
| 8 |