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
MarshalSK
Resolver I
Resolver I

How to calculate Average value for each category

Hi Folks, How to achieve Average Sales for each category ? Note: if you have Filters it should affect the visual

 

MarshalSK_0-1704214699143.png

 

4 REPLIES 4
MarshalSK
Resolver I
Resolver I

@AlexisOlson  - Thanks for the prompt response. To give you a big pitcure. I am trying to create year wise average line , even if i apply Region filter average should be calculated after filtering the data.

 

MarshalSK_0-1704216521398.png

 

If you want a flat average line, then you'll need to remove the date filter context.

 

For example,

CALCULATE (
    AVERAGE ( Table1[Sales] ),
    ALLSELECTED ( Table1[Year], Table1[Quarter] )
)

 

There are two approaches:

1. Specify what filters you want to remove (and keep all others) using ALL or ALLSELECTED.

2. Specify what filters you want to keep (and remove all others) using ALLEXCEPT.

AlexisOlson
Super User
Super User

It depends on how exactly you want it to work in general (what columns to ignore and what not to), but I'd start with something like this:

CALCULATE (
    AVERAGE ( Table1[Sales] ),
    ALLSELECTED ( Table1[Sub Category] )
)

This tells it to remove the visual's filter context on Sub Category.

Hi @AlexisOlson , I need to calculate Average line per year, It should accomdate the filters. average line should be calculated on top of filtered data set. 

if you aware of super store data set , can you try from your end and let me know the solution.

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.