I am trying to get a report using PI Data Link. I want to get daily max and mins for pH when a certain valve is open.
You can use Expressions in PI Data link functions as per your requirement. For more details refer Expressions in PI DataLink functions
The easiest way to do this is to use the Calculated Data function in Datalink. When you pull in events using the Calculated Data function, you can choose maximum as an option under Calculation mode, which will return the maximum value during a specified time interval. You can specify a time interval of 24h or 1d, along with a Start time and End time that define the start and end of your 'day,' and the maximum value during this interval will be returned for a given tag. For example, you could use a Start time of t with an end time of t-1d to get the max value that occurred between midnight today and midnight yesterday. You can than repeat this procedure a second time, specifying minimum under Calculation mode, to get the minimum daily value.
More information on the Calculated Data function can be found here: LiveLibrary: PI Datalink
Retrieving data ...