Forum Discussion

laingm's avatar
laingm
Regular Visitor
9 years ago

Calculated Measure Filter with only Slicer

I am trying to plot a constant horizontal line on my chart that is the value of a measure (calculated as mean(x) + std(x)). The problem I am having is that I want the mean(x) and std(x) to be calculated over the entire time range of the chart. The chart has datetime on the x-axis. When plotting the measure as a value, it appears that the measure is calculated at each time point.

 

By using the ALL in CALCULATE when calculating the measure, I can get all of the datetimes to be used. The problem is that I also have a slicer that shortens the time window shown on the chart. If I use ALL, the slicer is not taken into account when calculating the mean or std (it still uses every datetime in the table).

 

Is there a way to have the calculation only use the slicer as a filter (and not the chart axis)?

3 Replies

    • laingm's avatar
      laingm
      Regular Visitor

      This does not appear to be working for me:

       

      The calculated value (0.48) is the value I want the red line on the chart to be for the entire plot. Instead, the chart is recalulating the value at each time point on the plot. I want it to be static (horizontal) based on the time slicer for the entire page.

       

      The calculation I am using is;

      DIVIDE(CALCULATE(SUM(Events[Event Occurrences]), ALLSELECTED(CALENDAR[DateTime])),
              24. * CALCULATE(MAX(Events[DateTime])-MIN(Events[DateTime]), ALLSELECTED(CALENDAR[DateTime])) * CALCULATE(AVERAGE(Performance[Run %]), ALLSELECTED(CALENDAR[DateTime]))
          )

      I have tried ALLSELECTED, but it has the same result.