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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Dunner2020
Post Prodigy
Post Prodigy

Average measure does not update calculation when click on slicer.

Hi there,

 

I have created a measure that calculates the average value of a column named 'VoLL per hour' in the VoLL table. I want to use that measure as line value in Line and stacked column visualisation. The table looks like as follows:

 

VoLL pic1.jpg

 

I code the average measure as follows:

Average VoLL Feeder = CALCULATE(
AVERAGE(VoLL[VOLL per hour]),
ALL(VoLL)
)

 

Now the problem is that when I click on the slicer values (such as season slicer which contains  shoulder winter summer season), the average measure does not update its calculation. Could anyone help me where I am making the mistake?

1 ACCEPTED SOLUTION

@Dunner2020 ,
It was my mistake, didn't understand the issue.

Try using variables for all slicers that should influence the average value (my demo below - i am calculating avg of Sales column in Sales table and filter is from dimension Item):

Average Sales Amount  v2 =
var _selectedItem = ALLSELECTED('Item'[Item Id])
var _selectedRows = FILTER(ALL(Sales),Sales[Item Id] in _selectedItem)
RETURN
CALCULATE(AVERAGE(Sales[Sales]),_selectedRows)

If there are multiple slicers like Item impacting this calculation, add them like variable _selectedItem is created. And then add them to variable _selectedRows like _selectedItem is added.

If all items are selected, avg calculations are same:
dynamic avg 1.PNG
If only Items 1 and 3 are selected, yellow line shows avg value for only these items, and blue line is still showing avg for all items.
dynamic avg 2.PNG


View solution in original post

9 REPLIES 9
v-kelly-msft
Community Support
Community Support

Hi @Dunner2020

 

Create a measure as below:

 

Average VoLL Feeder  = 
IF(ISFILTERED('VoLL'[Season]),CALCULATE(AVERAGE('VoLL'[voll per hour]),FILTER(ALL('VoLL'),'VoLL'[Season]=SELECTEDVALUE('VoLL'[Season]))),CALCULATE(AVERAGE('VoLL'[voll per hour]),ALL('VoLL')))

 

 If above doesn work,could you pls upload your .pbix file to onedrive business and share the link with us?

 

 
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

@v-kelly-msft , it same issue. I am posting a picture of my data model. Slicer value coming from the Season table. I think there should not be a problem as long as the relationship is established. 

datamodel.jpg

 

@Dunner2020 ,
It was my mistake, didn't understand the issue.

Try using variables for all slicers that should influence the average value (my demo below - i am calculating avg of Sales column in Sales table and filter is from dimension Item):

Average Sales Amount  v2 =
var _selectedItem = ALLSELECTED('Item'[Item Id])
var _selectedRows = FILTER(ALL(Sales),Sales[Item Id] in _selectedItem)
RETURN
CALCULATE(AVERAGE(Sales[Sales]),_selectedRows)

If there are multiple slicers like Item impacting this calculation, add them like variable _selectedItem is created. And then add them to variable _selectedRows like _selectedItem is added.

If all items are selected, avg calculations are same:
dynamic avg 1.PNG
If only Items 1 and 3 are selected, yellow line shows avg value for only these items, and blue line is still showing avg for all items.
dynamic avg 2.PNG


mahoneypat
Microsoft Employee
Microsoft Employee

Please try using ALLSELECTED instead of ALL

 

Average VoLL Feeder = CALCULATE(
AVERAGE(VoLL[VOLL per hour]),
ALLSELECTED(VoLL)
)
 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@mahoneypat , ALLSELECTED(VoLL) does not produce the right answer. The average value is around 9000 and with ALLSELECTED(VoLL) it gives around 29000.

 

Please try just removing the filter from Feeder ID with

 

Average VoLL Feeder = CALCULATE(
AVERAGE(VoLL[VOLL per hour]),

ALL(VoLL[Feeder_ID)

)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@mahoneypat 😥😓. did not work

nandic
Super User
Super User

@Dunner2020 ,
Last row makes this formula independent from used slicer on Voll table.
ALL(VoLL) - means return everything, no matter what is selected.

Firstly try removing that part and see how it looks like.
After that you could try adding AllExcept(Voll[Season]) (instead of All(Voll)) and then selecting season filter will influence on calculation.

@nandic , I tried by removing all function. It started giving by an average by feeder id as shown in the figure:

 

graph1.jpg

 

If I include allexcept(VoLL[Season]), it does not make any difference when I apply season slicer on it.

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors
Top Kudoed Authors