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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
PedroAM
New Member

Average of some values under a circunstance

I have a situation where I want to do an average of some values that occur during the week. But I want to use in my average just the values that occurs, at least, 4 times in the week (in four different days) (otherwise my average will be lower thant expected). Here's my formula:

Mean Value Desired = DIVIDE(
IF(
BI[Contagem de sessões]>4,
'BI'[Valor2],0),
IF(
'BI'[Contagem de sessões]>4,
DISTINCTCOUNT('BI'[Player Name]),0)).
PedroAM_2-1693099177108.png

 


In the table above, although the column "mean value desired" shows only the values that match the formula's conditions (for example, "antony", "lucas silva", "romulo" and "vinicius jau" have values in "contagem de sessões" of 4 or less), the final average in total (34299,03) take into account all the values; the true value should be 39048 and be placed where is "34299" in the next picture.

 

PedroAM_3-1693099408230.png

 

The column "Semana" (week in portugues) came from the DAX WEEKNUM, with week starting on monday.

Sorry for fome words in portuges in the table but I think it wont difficult the understanding of my question,
 
Thank you!
1 REPLY 1
PedroAM
New Member

In fact what I wnat to do is

Mean Value Desired = DIVIDE( 'BI'[Valor2],
DISTINCTCOUNT('BI'[Player Name]))
But only utilise values of the ones that have data in >4 different days. So I tried:
Mean Value Desired = IF('BI'[Session Count]>4,
DIVIDE('BI'[Value],
DISTINCTCOUNT('BI'[Player Name])))
PedroAM_0-1693130643738.png

Again, it excludes the values unwanted from the table, but the calculation continues taking into account all values

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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