Forum Discussion

Mat42's avatar
Mat42
Resolver I
5 years ago
Solved

Fixed Chart Comparator

This feels like it should be simple, but for the life of me I can't work out how to do it.

Let's say I have a very simple table containing the following entries:

 

NameSales FiguresYearly Total
Dave1231119
Susan2231436
Linda5782007
Mike3421996
Steve1112015
Company Average413

2134

 

All I want to create is a simple, 2 bar horizontal bar graph to compare staff details against the Company Average. The slicer will contain staff names and when I choose a name, I want it to display the Company Average as a fixed comparator so that it will always be visible on the chart, but the staff name will change with the slicer.

 

I've attached a couple of example images.

 

 

I've tried various things and I just can't work it out...which feels stupid because it must be simple.

 

Any help would be greatly appreciated.

  • You don't need to include the Company average in your data if you can also compute it on the fly. But if that is not possible then you can still make it work by using a separate measure.

     

    Sales Average := CALCULATE(sum(Performance[Sales Figures]),Performance[Name]="Company Average")

     

    Then add the Sales Figures value and the new measure to the Values well.

     

     

     

     

     

     

     

     

4 Replies

  • You don't need to include the Company average in your data if you can also compute it on the fly. But if that is not possible then you can still make it work by using a separate measure.

     

    Sales Average := CALCULATE(sum(Performance[Sales Figures]),Performance[Name]="Company Average")

     

    Then add the Sales Figures value and the new measure to the Values well.

     

     

     

     

     

     

     

     

    • Mat42's avatar
      Mat42
      Resolver I

      lbendlin, that's brilliant and works as I need it to. Quick related follow-up question:

       

      Because this is part of a larger report I'm slowly building up, I'm adding new sections every day and I now have 2 tables: the simple data table I explained before, and a new table called 'Names' that I've created to only contain (unsurprisingly) staff names. I've joined the Names table to the data table using a one-to-one relationship. 

       

      If I follow your instructions, then produce a slicer containing staff names using the original data table, the chart displays correctly. However, if I create a slicer using the new Names table the Sales Average data disappears off the chart.

       

      Is there something that needs changing in the measure?

      • lbendlin's avatar
        lbendlin
        Super User

        Change the relationship to 1:M from Names to Data. Then change the measure to compute the company average properly as I mentioned initially.