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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.