Forum Discussion
miltenburger
7 years agoHelper V
Dynamic constant line
Hi Guys, I'm trying to figure out if there is a possibility to work with a dynamic constant line. My current visual is based on healthcare data. What I can show them right now is the running tota...
- 7 years ago
I'm afraid this couldn't be achieved because the value of constant line is determined by constant value, it can't be changed by slicer. As a workaround. I would recommend you to create a measure using DAX like pattern:
Measure = SELECTEDVALUE ( table[value] )
And then drag the measure to your chart.
Regards,
Jimmy Tao
marcoselias
7 years agoAdvocate V
Another approach/trick that worked for me was:
- Create a measure (may work with a calculated column that will later be summarized as average, MAX, MIN, etc.). The measure (or aggregation of calculated column) will have the dynamic value of the constant line you want to display. In my case, I used a measure and I am showing a constant line that changes value depending on the current month.
- Create your visual without the constant line first. In my case, I am using the clustered bar chart.
- Add the measure with the constant value to your list of values of the visual. The value will appear in your visual. In my case, it appeared as another horizontal bar. You'll hide it in a later step.
- Go to the analytics tab of the visual and instead of adding a new Constant Line, add a Min Line, Max Line, or whatever line makes more sense for your measure, column, visual, etc. as long as the option you choose allows you to select the measure/column you added in the previous step. From the formatting options of the line you added, click on the dropdown labeled "Measure" and pick the measure that has the value of the constant line.
- Finish formatting the line as you want (title, text position, color, etc.).
- Go back to the Fields tab of the visual and drag the measure with the constant value from the Value group to the Tooltips group. The value will now disappear from the visual but the constant line should remain.
- (optional) If you do not want the value of the now dynamic constant line to show in the Tooltip of the visual, create a custom visual. However, keep in mind that if the user is viewing the report in a way that doesn't support report page tooltips, the user will see the default Tooltip including the value of the dynamic constant line you just created.
Anonymous
7 years agoNot applicable
Very clever!