Tag historian query for mathematical

I use the tag historian query in the report, get some history data.
How to use these data for mathematical operations, logical judgments and so on

anyone know this quest ? help !