-
What Grafana version and what operating system are you using?
8.1.2 - Ubuntu -
What are you trying to achieve?
My goal is to achieve table view of my closed trades grouped by date… -
How are you trying to achieve it?
I made this query (sqlite as datasource).
SELECT
date(close_date) AS “Date”,
(SELECT COUNT() FROM trades WHERE close_profit > 0 AND date(c2.close_date) = date(close_date)) AS Wins,
(SELECT COUNT() FROM trades WHERE close_profit < 0 AND date(c2.close_date) = date(close_date)) AS Losses,
(SELECT AVG(close_profit * 100) FROM trades WHERE date(c2.close_date) = date(close_date)) AS “Avg”,
(SELECT SUM(close_profit_abs) FROM trades WHERE date(c2.close_date) = date(close_date)) AS “Profit”
FROM trades c2 WHERE date(close_date) IS NOT NULL GROUP BY date(close_date)
This will list dates (closed_date from table trades), Wins, Losses, Avg and Profit.
It works perfectly with one data source but I have six of them.
How do I have to change the query in a way that I can do use multiple datasources (mixed) at the same time ?
On my dashboard I have variable which lists all my sqlite datasources, but I use that as datasource with this particular query only the first sqlite db is used.
I can use the db selector from dashboard but this query only works with one db selected, if more than one is selected then only the first db selected is counted.
Any help is appcreciated… Thank you