execute_dax_query
Execute DAX queries on Power BI datasets to analyze data and retrieve insights through the Microsoft Fabric MCP Server.
Instructions
Execute a DAX query on a Power BI dataset
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| datasetId | Yes | The ID of the dataset | |
| query | Yes | The DAX query to execute |
Implementation Reference
- src/powerbi-client.ts:67-81 (handler)The implementation of the executeDaxQuery method in the PowerBIClient class.
async executeDaxQuery(datasetId: string, query: string): Promise<DaxQueryResult> { try { const response = await this.apiClient.post(`/datasets/${datasetId}/executeQueries`, { queries: [ { query: query } ] }); return response.data; } catch (error) { console.error('Error executing DAX query:', error); throw error; } } - src/index.ts:172-183 (registration)The MCP tool handler for 'execute_dax_query' in src/index.ts.
case 'execute_dax_query': { const { datasetId, query } = ExecuteDaxQuerySchema.parse(args); const result = await powerBIClient.executeDaxQuery(datasetId, query); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } - src/index.ts:18-21 (schema)The Zod schema validation for the 'execute_dax_query' tool arguments.
const ExecuteDaxQuerySchema = z.object({ datasetId: z.string().describe('The ID of the dataset'), query: z.string().describe('The DAX query to execute'), });