Forum Discussion

ScottBurns's avatar
ScottBurns
Regular Visitor
9 months ago

Vertical Line on Trend Chart

Greetings,

 

I have a trend chart with a list of locations and their execution percentages.  Along the X axis is that week number of the last training date.  I would like to easily see on the trend chart when a location is selected a vertical line indicating when their last training date was to see if the training had any impact on the execution trend.  The vertical line would change positions depending on the location selected, and ideally disappear when no location is selected.  I've searched all around and this seems to be difficult to do.  Does anyone have any advice or instruction on how to accomplish this?

 

Thanks

 

 

7 Replies

  • Hi ScottBurns 

     

    From the analytics pane and the x-axis is set to continous, you can add an X-axis constant line which value is defined by a measure. In the image below, I am simply returning the mid of the month

     

  • Hi

     

    I'd recommend following the idea from this tutorial video. 

    Power BI - Dynamic Reference Line on X-Axis 

     

    For the measure logic, try and tweak on top of this below or provide some sample data or .pbix so that other users can play with. 

    VerticalLine :=
    VAR SelectedLoc =
        SELECTEDVALUE(table1[Location])
    
    VAR LastTrainingDate =
        CALCULATE(
            MAX(table2[TrainingDate]),
            Training[Location] = SelectedLoc
        )
    
    VAR LastTrainingWeek =
        CALCULATE(
            MAX(table2[TrainingWeek]),
            Training[TrainingDate] = LastTrainingDate
        )
    
    VAR AxisWeek =
        SELECTEDVALUE(date[WeekNumber])
    
    VAR MaxY =
        CALCULATE(
            MAX([%SurveyCompletedMeasure]),
            ALLSELECTED(Calendar)
        )
    
    RETURN
    IF(
        NOT ISBLANK(SelectedLoc) &&
        NOT ISBLANK(LastTrainingWeek) &&
        AxisWeek = LastTrainingWeek,
        MaxY
    )

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ScottBurns,

     

    Thank you for reaching out to the Microsoft Fabric Forum Community, and special thanks to danextian , Ashish_Mathur  and MasonMA  for prompt and helpful responses.

    Just following up to see if the Response provided by community members were helpful in addressing the issue. if the issue still persists Feel free to reach out if you need any further clarification or assistance.

     

    Best regards,
    Prasanna Kumar

     

  • ScottBurns's avatar
    ScottBurns
    Regular Visitor

    Thank you for taking the time to respond to my inquiry! 

    I will dive into the couple of suggestions above and see how I make out and report back with comments and screenshots if I am successful.  

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ScottBurns,

     

    hope you’re doing well. Just wanted to check if there’s any tentative ETA available for this.

     

    Thanks & Regards,

    Prasanna Kumar

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ScottBurns,

     

    Just following up to see if the Response provided by community members were helpful in addressing the issue. if the issue still persists Feel free to reach out if you need any further clarification or assistance.

     

    Best regards,
    Prasanna Kumar