documentation/integrations/visualization/powerbi.md
import Screenshot from "@theme/Screenshot"
This guide demonstrates how to connect QuestDB with Microsoft PowerBI to create interactive data visualizations and dashboards.
QuestDB utilizes a fully featured PostgreSQL Wire Protocol (PGWire). As such, setup for PowerBI mirrors the standard PostgreSQL connection setup. The benefit is the performance profile of QuestDB, and its powerful time-series SQL extensions, with the simplicity of the PGWire protocol.
Open PowerBI Desktop
Click "Get Data" in the Home tab
<Screenshot alt="Select Get Data" src="images/docs/powerbi/powerbi-1.webp" />
<Screenshot alt="Select PostgreSQL" src="images/docs/powerbi/powerbi-2.webp" />
Enter your QuestDB connection details:
localhost (or your server address)qdbImport8812 (default QuestDB PGWire port)Select:
adminquestClick "Connect"
To leverage QuestDB-specific features like SAMPLE BY and LATEST ON, you can use custom SQL:
Remember, you must include a timestamp column when using functions like
SAMPLE BY.
Here are some useful query examples:
-- Get 1-hour samples of trade prices
SELECT
timestamp,
avg(price) as avg_price,
sum(amount) as volume
FROM trades
WHERE timestamp >= dateadd('d', -7, now())
SAMPLE BY 1h;
-- Get latest trade for each symbol
SELECT * FROM trades
LATEST ON timestamp PARTITION BY symbol;
-- Combine SAMPLE BY with multiple aggregations
SELECT
timestamp,
symbol,
max(price) max_price,
min(price) min_price,
avg(price) avg_price
FROM trades
WHERE timestamp >= dateadd('M', -1, now())
SAMPLE BY 1d
ALIGN TO CALENDAR;
QuestDB currently cannot be used as a source for PowerBI's "Mark as Date Table" feature. This means:
:::tip
If you'd like QuestDB to support this feature, please add a 👍 to this GitHub issue.
:::
pg.enabled=true - see configuration for more details8812 is open and not blocked by firewalls