Dynamic Constant Line in PowerBI Line Chart

27 Views Asked by At

I have a line graph that I'm attempting to create a constant line that is based on a value that's in the chart. What I need is the value in [Sept 2023-5%=constant line]. The problem is the value for Sept 2023 will change depending on a filter that applies to the whole page.

So for the example below, would need a constant line to show at 53% across.

Is that possible?

enter image description here

1

There are 1 best solutions below

2
zach On

Yes this is possible. We can use functions like ALL and CALCULATE to override filters if you would like to keep the value constant. To make constant lines (that are not dynamic based on data), you can manually put in the line or create a new measure like Constant Line = .53. Then, in the analytics pane, you can manually put in the value, or use the measure in the f(x) box.

enter image description here

If you want a dynamic line based on the first month in the line chart, you could add a measure like this:

Constant Line From First Month = 
var minMonth = MIN((YourTableHere[month]))
var result = CALCULATE(SUM(YourTableHere[value]),YourTableHere[month]=minMonth)-.05
return
result

enter image description here