Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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 @Ash10 ,
You can create a measure that dynamically calculates whether a timestamp falls within the 5-day range before or after the selected timestamp.
WithinRange =
VAR SelectedDate = SELECTEDVALUE('table'[timestamp])
VAR StartDate = SelectedDate - 5
VAR EndDate = SelectedDate + 5
RETURN
IF(
'table'[timestamp] >= StartDate &&
'table'[timestamp] <= EndDate,
1, 0
)
Next, in the line chart, add this WithinRange measure to the visual-level filter. Set the filter condition to show values where WithinRange = 1.
Then, set up interaction between the table and the line chart by using the Visual Interactions tool in Power BI. This will ensure that when a user clicks on a timestamp in the table, it dynamically updates the line chart.
Calculated columns would result in static values, whereas using a measure provides dynamic filtering that updates the line chart based on user interactions. This is why using a measure is preferred for this task.
sorry, this is not working, when I set up interaction between the table and the line chart by using the Visual Interactions tool in Power BI the line chart is filtered to one value, this is because my X axis is timestamp
Hi @Ash10
you should use a measure to calculate the Y-axis value. you can write the measure as follows : (lets assume thatyou have sales data)
measure sales_in range := calcualte (sum(sales) , filter (all(table) , timestamp>= selectedvalue(timestamp) - 5 && timestamp<= selectedvalue(timestamp) + 5)
If this post helps, then I would appreciate a thumbs up and mark it as the solution to help the other members find it more quickly.
Hi Thank you for your solution, Unfortunately it is not working :(.
when I select only one timestamp due to interaction it is filtering to only one point in line chart, if I block interaction it is not working
you should have a Dimdate table and selected timestamp slicer, should be added to this report using DimDate
you can create a table with minimum date and maximum date you need to have as follows:
then go to transform data (edit query) and add a custom column using the following formula:
{Number.From([start date])..Number.From([end date])}
then click on the specified list and expand. this can call your DimDate table.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
17 | |
10 | |
10 | |
8 | |
6 |
User | Count |
---|---|
18 | |
16 | |
15 | |
12 | |
10 |