Our factory runs 4 days and is off for 3 days. While most of the tags are setup for recording data in historian on % change, we still get huge amount of data recorded while the factory is not running.
Is there a clean way to turn off gateway or S&F based on schedule?
I'm not sure if the solution you asked for is possible. The problem appears to be that you store data when there's not activity.
One idea is to perform periodic maintenance, deleting all data between active dates. You could set up a maintenance plan (Microsoft SQL server) to run at some interval. It can run an statement or SP that deletes the data that exists in whatever timespans you need. This makes sense if you have storage concerns.
If space isn't a concern, whenever you query the data, you can neglect the time between active states. This aligns more with the idea of storing everything and transforming as needed.