Apply filter to change the visualization

Hi there, I have a line chart to show the hourly production chart that shows 24-hour data from 7 AM to 7 AM. Regarding this, I already asked a question here and now we get the start time and end time as desired.

I would like to integrate the new date field into my visualization to create a filter that allows me to display the visualization based on user input. We have calculated the ‘End_Date’ using the formula addDateTime(1439, 'MI', parseDate(toString(${Date}), 'yyyy/MM/dd HH:mm:ss')), which is based on the ‘Date’ parameter control field provided by the user.

Now, the challenge is how to incorporate this calculated ‘End_Date’ field into my filter so that the visualization can be filtered to display data within the user-specified ‘Date_Control’ range, which includes the chosen ‘Date’ and the calculated ‘End_Date’.

Any help would be really appreciated, thanks in advance

Hello @Harsheena, for the data to display within the range, you will need to utilize an ifelse statement for the start date and calculated end date rather than filtering the visual itself.

ifelse(${StartDate} <= {Date} AND {CalculatedEndDate} >= {Date}, {The data field you want}, NULL)

Then, what you would do is filter by the calculated field above instead of by Date. Utilize a filter where Filter condition will be “Does not equal” and you may be able to leave it blank or enter an impossible value, then in the “Null options” dropdown select exclude Nulls. This will make sure only data will be returned when the date fields match the dates calculated from the Start and End Date parameters.

1 Like

@DylanM Thanks for the help and it is working.

1 Like