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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Zyg_D
Continued Contributor
Continued Contributor

Comparing to category average

I have the 3 first columns, and I want to get the blue one. The values are obtained by comparing grades to grade averages of each area. How to do it?

image.png

1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hi @Zyg_D ,

 

Try this one:

 

Column =
VAR _avg = CALCULATE(AVERAGE('Table (2)'[Grade]); FILTER('Table (2)'; 'Table (2)'[Area] = EARLIER('Table (2)'[Area])))
RETURN IF('Table (2)'[Grade] < _avg; "Below Average";
IF('Table (2)'[Grade] = _avg; "Average";
"Above Average")
)
 
This column is static, if you need it dynamically you can use this link as reference:
 
 
Did I answer your question? Mark my post as a solution!
Ricardo
 


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

Proud to be a Super User!



View solution in original post

7 REPLIES 7
AlB
Community Champion
Community Champion

Hi @Zyg_D 

Create a new calculated column in your table:

above_below =
VAR area_avg_ =
    CALCULATE ( AVERAGE ( Table1[grade] ), ALLEXCEPT ( Table1, Table1[area] ) )
RETURN
    SWITCH (
        TRUE (),
        Table1[grade] > area_avg_, "above average",
        Table1[grade] = area_avg_, "average",
        Table1[grade] < area_avg_, "below average"
    )

Please mark the question solved when done and consider giving kudos if posts are helpful.

 Cheers 

SU18_powerbi_badge

 

 

Zyg_D
Continued Contributor
Continued Contributor


@AlB wrote:

Create a new calculated column in your table:

 

above_below =
VAR area_avg_ =
    CALCULATE ( AVERAGE ( Table1[grade] ), ALLEXCEPT ( Table1, Table1[area] ) )
RETURN
    SWITCH (
        TRUE (),
        Table1[grade] > area_avg_, "above average",
        Table1[grade] = area_avg_, "average",
        Table1[grade] < area_avg_, "below average"
    )

 

 


Although I like that you properly formatted your answer, it evaluated as error to me. 

camargos88
Community Champion
Community Champion

Hi @Zyg_D ,

 

Try this one:

 

Column =
VAR _avg = CALCULATE(AVERAGE('Table (2)'[Grade]); FILTER('Table (2)'; 'Table (2)'[Area] = EARLIER('Table (2)'[Area])))
RETURN IF('Table (2)'[Grade] < _avg; "Below Average";
IF('Table (2)'[Grade] = _avg; "Average";
"Above Average")
)
 
This column is static, if you need it dynamically you can use this link as reference:
 
 
Did I answer your question? Mark my post as a solution!
Ricardo
 


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

Proud to be a Super User!



Greg_Deckler
Community Champion
Community Champion

above/below =
VAR __grade = MAX('Table'[grade])
VAR __area = MAX('Table'[area])
VAR __average = AVERAGEX(FILTER(ALL('Table'),[area]=__area),[grade])
IF(__grade >= __average,"above average","below average")


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Zyg_D
Continued Contributor
Continued Contributor


@Greg_Deckler wrote:
above/below =
VAR __grade = MAX('Table'[grade])
VAR __area = MAX('Table'[area])
VAR __average = AVERAGEX(FILTER(ALL('Table'),[area]=__area),[grade])
IF(__grade >= __average,"above average","below average")

Sorry, even after adding RETURN before IF it yields wrong results - always above average.

Because it is a measure and you are probably trying to use it in a column.

 

Column form:

 

above/below =
  VAR __grade = [grade]
  VAR __area = [area]
  VAR __average = AVERAGEX(FILTER('Table',[area]=__area),[grade])
RETURN
  IF(__grade >= __average,"above average","below average")

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Zyg_D
Continued Contributor
Continued Contributor


@Greg_Deckler wrote:

Because it is a measure and you are probably trying to use it in a column.

 

Column form:

 

 

above/below =
  VAR __grade = [grade]
  VAR __area = [area]
  VAR __average = AVERAGEX(FILTER('Table',[area]=__area),[grade])
RETURN
  IF(__grade >= __average,"above average","below average")

 

 


Is performance-wise measure better than calculated column?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.