cancel
Showing results for
Did you mean:
Helper I

## Measure showing % or # of Attributes bellow average

Hi there,

Im trying to create a measure that would show me the percentage of Attributes bellow the average value of all attributes (filterable by date slicers).

I understand this could be easily done by creating a calculated collumn, but due to performance impact I would like to prefer if this could be done using only one measure.

I've tried

Bellow Average =
var CheckIf = IF([Total Value]<[Average Value],1,0)
var TempTable = SUMMARIZE(Table,Table[Attribute],"Atributes",CheckIf)
return
SUMX(TempTable,[Atributes])

but it's returning 0... 😕

1 ACCEPTED SOLUTION
Community Support

Hi @Parreirao2 ，

Pls test the below:

``avarage2 = calculate(AVERAGE('Table'[Value]),ALL('Table'))``
``sum2 = CALCULATE( SUM('Table'[Value]),ALL('Table'))``
``countblewavg = CALCULATE(COUNT('Table'[Attribute]),FILTER(ALL('Table'),'Table'[Value]<=[avarage2]))``

output result:

And if you need slicer in your table ,change all to allselected.

Best Regards

Lucien

5 REPLIES 5
Community Support

Hi @Parreirao2 ，

Pls test the below:

``avarage2 = calculate(AVERAGE('Table'[Value]),ALL('Table'))``
``sum2 = CALCULATE( SUM('Table'[Value]),ALL('Table'))``
``countblewavg = CALCULATE(COUNT('Table'[Attribute]),FILTER(ALL('Table'),'Table'[Value]<=[avarage2]))``

output result:

And if you need slicer in your table ,change all to allselected.

Best Regards

Lucien

Super User

Hi agaia Parreirao2

Ha Ha.  Think about it.  They wont wont.

If you use SUM they the Total and Avergae will be the same as the Total Value for each row.

You need to wrap them in a calculate ALL to get the average and totals.

for example ....

Average Value =
CALCULATE(
Average(Table[Value]),

ALL()
)

Please click the thumbs up and accept as solution button 😀

Helper I

I thought of that and tried it, it still showed me zero :S

Check images bellow:

Super User

Hi Parreirao2

You have not provided the DAX formulas for [Total Value] and [Average Value].  😀

Helper I

They're in the attached image 😛

But here they are again:

Average Value = Average(Table[Value])

Total Value = Sum(Table[Value]

Announcements

#### The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

#### Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!