Skip to main content
cancel
Showing results for 
Search instead 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.

Reply
Anonymous
Not applicable

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).

Parreirao2_0-1651772367143.png

 

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... 😕

 

Thanks in advance!

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

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:

vluwangmsft_0-1654067146962.png

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

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

5 REPLIES 5
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

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:

vluwangmsft_0-1654067146962.png

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

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

speedramps
Super User
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 😀

 

 

Anonymous
Not applicable

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

 

Check images bellow:

Parreirao2_0-1651775522243.pngParreirao2_1-1651775568942.png

Parreirao2_2-1651775599410.png

 

 

speedramps
Super User
Super User

Hi Parreirao2

 

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

 

Anonymous
Not applicable

They're in the attached image 😛


But here they are again:

Average Value = Average(Table[Value])

Total Value = Sum(Table[Value]

Helpful resources

Announcements
Microsoft Fabric Learn Together

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

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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