I would suggest you to set AF analysis and write the output to attribute. Using PI Web API web call you can get data from the attribute.
If you are looking to filter in PI Web API call then request you to check in the link below
Comparison operators and logical operators are both supported PE syntax so you should be able to use them without issue using the calculation controller. Have you tried doing so and are having issues? You should take care to have proper URL encoding for space characters and you may need to encode the comparison operators themselves.
Oscar Garcia Lino, I agree that PE functions are probably not going to help you here. I would rework PI Datalinks time-filtered into a time-weighted total. Basically, you could write if 'expression' = true then 1 else 0, and perform a time-weighted total. In PI Datalink terms, you are doing a Calculation function on an expression. Note, you will have to implement the conversion factor yourself.
You might also want to look at GetSummary GET calculation/summary