How calculate integral of history tag

I want to have integral of a history tag in selected range. The history only log data when I have change in value so multiply it by time not valid option here.
appreciate for any idea.

Hi Chris,

Did you see this topic? (Note: The link in that post is dead. Use the one in the bottom post.)