Maximum Energy Used to Tag

I realize that this may be a basic question, but I am confused as to approach and need some assistance. I have a facility that is billed based on maximum electrical demand. The utility company has some funky rules about when they read the meter, so I have already created a tag that uses the rules to determine the date the energy usage needs to get reset.

Based on this date, I would like to create a tag that shows the max energy usage from this date to now. I know this is fairly simple, I have it shown on a screen, but I just use the Tag History Binding to a start date of {Root Container.Group 1.CurrentDemandMonth.startDate} and stop date of {Root Container.Group 1.CurrentDemandMonth.endDate}, then return the maximum value using the aggregation method and a fixed sample size of 1.

How would I go about doing the same thing, to log this to a tag? Thanks for any direction or ideas.

I would just take that same expression and make it an expression tag. It may need some tweaks for your dates, but you can then use that tag to setup history as well as use on screens.

That is where I get a little confused. If I am in a historical binding, I have all the screens to pull up the tag and enter the binding dates, and then Ignition takes care of the magic.

How do I query a tag without the ignition’s Historical Query Feature to create a tag?