Hi Jitesh,
Say that the condition you used to remove the data from "$signal" is called "$condition."
If I understand correctly, you want your signal to display the mean or median value during condition.
First you must calculate the mean or median value. There are multiple ways to do this, I will share two:
Zoom out in the display range to a period over which you want to find the mean/median. Use Simple Scorecard Metric to calculate mean or median during this period. Say the mean was 2.55
Then use formula to create a signal called, "Mean" which is:
2.55.tosignal()
Find the mean/median value around the capsules where data was removed. To do this, use the grow function to grow the capsules - $condition.grow(1 hr). Then use Signal from Condition to calculate the mean/median value during these times (call this "MeanDuringGrownCapsules"). In the signal from condition, use step interpolation and place the sample over the duration of the capsules.
Next you must splice in the mean during the gaps. The formulas to do this is splice() or spliceblend().
$signal.splice($mean [or "MeanDuringGrownCapsules"] , $condition)
The difference between splice() and spliceblend() is that spliceblend() will smoothly join the samples from the original signal and the replacement signal, while splice() will create a discontinuity.
Let me know if this helps!