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

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

Reply
Anonymous
Not applicable

Average of sum of total dynamically

Hi,

 

I have the matrix below:

I need to create a measure that average the line Total dyamically. (I will use this measure as a line over bar chart)

 

For example. sum all the totals and divide by the numbers of years that I want (i.e sum from 2010 to 2015 and divide by 5 or sum the totals from 2010 to 2012 and divide by 2)

 

Is this possible creating some parameter?

fabnishi1207_0-1617162837721.png

 

Thank you

 

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

Hi  @Anonymous ,

 

First create a parameter table as below,which is for dynamic selection:

Slicer table = GENERATESERIES(1,12,1)

Then create  a  measure as below:

Measure = IF(
    NOT(ISFILTERED('Slicer table'[Value])),CALCULATE(SUM('Table'[Value])),
    IF(ISINSCOPE('Table'[Country]),CALCULATE(SUM('Table'[Value])),
 var _sum=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Year]>=MAX('Table'[Year])-SELECTEDVALUE('Slicer table'[Value])&&'Table'[Year]<=MAX('Table'[Year])))
 Return
 DIVIDE(_sum,SELECTEDVALUE('Slicer table'[Value]))))

And you will see:

v-kelly-msft_0-1617348342611.png

For the related .pbix file,pls see attached.

 

 

Best Regards,
Kelly

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

 

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

First create a parameter table as below,which is for dynamic selection:

Slicer table = GENERATESERIES(1,12,1)

Then create  a  measure as below:

Measure = IF(
    NOT(ISFILTERED('Slicer table'[Value])),CALCULATE(SUM('Table'[Value])),
    IF(ISINSCOPE('Table'[Country]),CALCULATE(SUM('Table'[Value])),
 var _sum=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Year]>=MAX('Table'[Year])-SELECTEDVALUE('Slicer table'[Value])&&'Table'[Year]<=MAX('Table'[Year])))
 Return
 DIVIDE(_sum,SELECTEDVALUE('Slicer table'[Value]))))

And you will see:

v-kelly-msft_0-1617348342611.png

For the related .pbix file,pls see attached.

 

 

Best Regards,
Kelly

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

 

amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

AverageX(summarize(Table, Table[City], Table[Year], "_1",[measure]) ,[measure])

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.