Forum Discussion
VBA support (to pass cell value as a dax filter) needed to pull data from power bi to excel
- 4 months ago
Thank you for providing the complete VBA code. The discrepancy in row counts isn’t due to the DAX query itself DAX Studio returns all 11k rows but rather how Excel processes the ADODB recordset. By default, a forward-only cursor may stop early and not return all results.
A common fix is to adjust the recordset properties before opening, for example
rs.CursorLocation = 3 ' adUseClient rs.CursorType = 1 ' adOpenKeyset rs.LockType = 1 ' adLockReadOnly rs.MaxRecords = 0 ' no row limitAdditionally, ensure that .CopyFromRecordset isn’t restricted by MaxRows. You can refer to Microsoft’s documentation here: Range.CopyFromRecordset method (Excel) | Microsoft Learn
These adjustments are often suggested when importing larger datasets into Excel and should help you retrieve the full 11k rows from your Power BI dataset.
Please adjust these settings on your side and let us know how it works. If anything seems unclear or if I’ve misunderstood, just let us know.
Hi RoySampad ,
We haven’t received any response as of now. Kindly take some time to review our response, and please let us know if any additional details or clarification are required from our side.
Thanks