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! Learn more

Reply
Anonymous
Not applicable

Average Lines for Legend Values on Same Graph as Original Values

I have a line graph which displays conversion rate for two categories (A and B) with week number on the x axis. I have a legend on the graph so the rate for the two categories are displayed separately as two lines. 

Is it possible to add an average line for each of the category values, while retaining the original conversion rate lines also?

When I add an average line using the Analytics function, it takes the average value for both categories as a single line. When I create averages measures for each category, I am not able to add these to the values area of the graph because it will replace the original conversion rate lines.

A similar question was asked recently but did not address how to get the averages lines on the same graph as the original conversion rate lines.

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi  @Anonymous ,

 

When using a legend on a line chart (or any other type) the calcuations of the average is based on the all the data an not one for each of the categories of the legend.

 

In this case you need to create 4 measures 2 for the convertions rates A and B and another for the averages A and B.

 

Don't know what type of aggregaiton you are using on your model but you can use something similar to this:

Measure A = CALCULATE(SUM(Table[Column]); Table[Category]= "A")

Measure B = CALCULATE(SUM(Table[Column]); Table[Category]= "B")

Average A = AVERAGEX(ALL(Table[Week]); [Measure A])

Average B = AVERAGEX(ALL(Table[Week]); [Measure B])

 

Be aware that the average values can be calculated in other ways and not only on the averagex but is just a way.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi  @Anonymous ,

 

When using a legend on a line chart (or any other type) the calcuations of the average is based on the all the data an not one for each of the categories of the legend.

 

In this case you need to create 4 measures 2 for the convertions rates A and B and another for the averages A and B.

 

Don't know what type of aggregaiton you are using on your model but you can use something similar to this:

Measure A = CALCULATE(SUM(Table[Column]); Table[Category]= "A")

Measure B = CALCULATE(SUM(Table[Column]); Table[Category]= "B")

Average A = AVERAGEX(ALL(Table[Week]); [Measure A])

Average B = AVERAGEX(ALL(Table[Week]); [Measure B])

 

Be aware that the average values can be calculated in other ways and not only on the averagex but is just a way.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



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