Forum Discussion
PowerOper
7 years agoFrequent Visitor
Cross plot of same field with two different filters applied
I have a table 'tbl_values' with 3 fields that stores time and value pairs for different entities [entity_ID] [time] [value] I would like to cross plot the values for one entity_ID vs. the ...
- 7 years ago
I've solved my problem by adding 2 queries that select rows from the initial values table for a specific entity_ID
PowerOper
7 years agoFrequent Visitor
Hi, here is some sample data to show what I am looking to do. I would like to specify 2 entity_ID values, and extract the values at coinciding times for each entity_ID to cross plot one vs the other.
| SAMPLE DATA | ||
| tbl_values | ||
| entity_ID | time | value |
| 100 | 2019-09-01 0:00 | 518 |
| 100 | 2019-09-01 1:00 | 578 |
| 100 | 2019-09-01 2:00 | 541 |
| 100 | 2019-09-01 3:00 | 600 |
| 100 | 2019-09-01 4:00 | 551 |
| 100 | 2019-09-01 5:00 | 430 |
| 100 | 2019-09-01 6:00 | 446 |
| 100 | 2019-09-01 7:00 | 458 |
| 100 | 2019-09-01 8:00 | 490 |
| 100 | 2019-09-01 9:00 | 573 |
| 100 | 2019-09-01 10:00 | 545 |
| 100 | 2019-09-01 11:00 | 481 |
| 100 | 2019-09-01 12:00 | 519 |
| 200 | 2019-09-01 0:00 | 7,699 |
| 200 | 2019-09-01 1:00 | 8,560 |
| 200 | 2019-09-01 2:00 | 8,018 |
| 200 | 2019-09-01 3:00 | 8,900 |
| 200 | 2019-09-01 4:00 | 8,161 |
| 200 | 2019-09-01 5:00 | 6,611 |
| 200 | 2019-09-01 6:00 | 6,794 |
| 200 | 2019-09-01 7:00 | 6,935 |
| 200 | 2019-09-01 8:00 | 7,331 |
| 200 | 2019-09-01 9:00 | 8,485 |
| 200 | 2019-09-01 10:00 | 8,075 |
| 200 | 2019-09-01 11:00 | 7,217 |
| 200 | 2019-09-01 12:00 | 7,713 |
Desired Output for value crossplot: entity_ID=200 vs entity_ID=100
| value_x | value_y |
| 518 | 7,699 |
| 578 | 8,560 |
| 541 | 8,018 |
| 600 | 8,900 |
| 551 | 8,161 |
| 430 | 6,611 |
| 446 | 6,794 |
| 458 | 6,935 |
| 490 | 7,331 |
| 573 | 8,485 |
| 545 | 8,075 |
| 481 | 7,217 |
| 519 | 7,713 |
PowerOper
7 years agoFrequent Visitor
I've solved my problem by adding 2 queries that select rows from the initial values table for a specific entity_ID