Forum Discussion

nkpenta's avatar
nkpenta
Microsoft Employee
3 years ago
Solved

dynamic constant line for blank value

HI,

 

Dynamic constant line is showing at 0 when the measure value is blank. how can we not show the constant line when the measure value is blank?

  • Added if condition on the measure as below to fix the issue. it works now.
    if(measure<>blank(),measure,"Text")

6 Replies

    • nkpenta's avatar
      nkpenta
      Microsoft Employee

      thanks. following the link you shared. Issue is still under investigation.

  • nkpenta's avatar
    nkpenta
    Microsoft Employee

    Added if condition on the measure as below to fix the issue. it works now.
    if(measure<>blank(),measure,"Text")

    • Anonymous's avatar
      Anonymous
      Not applicable

      FYI - when attempting to use multiple constant lines on the same visual, this temp solution needs a little bit more to work.  

      my requirement is to display between 1 and 3 different constant "benchmark" values base on 3 different slicer parameters (show value 1, show value 2, show value 3.)

      to get it to work, I am using 3 constant lines with three different measures. 
      Each Measure has the ability to return the constant value (calculated in a Variable wihtin DAX to ensure it is a constant) or a blank depending on other values in the dataset.   

      Using the additional logic to replace the blank with a "Text" works to hide the constant line BUT ONLY WHEN THE FIRST constant line is showing on the visual.  if the first constant line is not showing (aka, the value is set to "Text" for all the constant lines,) then all of my regular charted values look very strange and get plotted at the same y intercept regardless of what their values really are.

      To Workaround, setup the first constant line named "Placeholder"as a constant which intercepts at 0 (no measure needed... just set the value to 0).  make the line transparent so it can't be seen.  add your other constant lines as needed but make them measure driven so they return the needed constant value or "Text".  

      Once that placeholder constant line is established, I then have the ability to independantly turn on or off the constant lines via the slicers.

      • 009co's avatar
        009co
        Helper IV

        The Placeholder solution is fantastic. It mitigates this Constant Line null to zero bug.

         

        Just want to highlight that the solution requires putting the Placeholder = 0 constant line first before the other real constant lines.