Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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 separatel...
  • MFelix's avatar
    6 years ago

    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.