Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Need help in visual interaction

Hi, 

 

I have a table visual which has a timestamp column and a line chart with same timestamp column in X axis.

Now when I/end user click on any time stamp value I need the line chart to display last 5 days and next 5 days values and dynamicaly changes based on selected timestamp value. 

 

I tried created two measures as last5Day = selectedvalue('table'[timestamp]) - 5 and next5Day = selectedvalue('table'[timestamp]) + 5, now I tried adding these two measures in minimum and maximum X axis vales in visualization pane, but it is not working. 

If any leads please let me know. Thanks in Advance

  • Hi Anonymous -Ensure that both your table visual and the line chart are using the same timestamp field from the same table or model, so that interactions between the visuals work smoothly.You may also want to format the x-axis of the line chart to show appropriate date intervals (like days) for better visibility.

    When you or the end user clicks on any timestamp in the table visual, the SelectedTimestamp measure will capture that value. Then, the IsInRange measure will filter the data on the line chart to show only the data from 5 days before and 5 days after the selected timestamp. This will dynamically update the chart as you click on different timestamps.

     

    IsInRange =
    VAR SelectedTime = [SelectedTimestamp]
    RETURN
    IF (
    NOT ISBLANK(SelectedTime),
    IF (
    'table'[timestamp] >= (SelectedTime - 5) && 'table'[timestamp] <= (SelectedTime + 5),
    1,
    0
    ),
    1 -- default to showing all data if no timestamp is selected
    )

    use the above flag in visual level filter Set the filter to show only when IsInRange = 1.

     

    Hope it works. 

     

2 Replies

  • Hi Anonymous -Ensure that both your table visual and the line chart are using the same timestamp field from the same table or model, so that interactions between the visuals work smoothly.You may also want to format the x-axis of the line chart to show appropriate date intervals (like days) for better visibility.

    When you or the end user clicks on any timestamp in the table visual, the SelectedTimestamp measure will capture that value. Then, the IsInRange measure will filter the data on the line chart to show only the data from 5 days before and 5 days after the selected timestamp. This will dynamically update the chart as you click on different timestamps.

     

    IsInRange =
    VAR SelectedTime = [SelectedTimestamp]
    RETURN
    IF (
    NOT ISBLANK(SelectedTime),
    IF (
    'table'[timestamp] >= (SelectedTime - 5) && 'table'[timestamp] <= (SelectedTime + 5),
    1,
    0
    ),
    1 -- default to showing all data if no timestamp is selected
    )

    use the above flag in visual level filter Set the filter to show only when IsInRange = 1.

     

    Hope it works.