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
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
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.