Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Krishanu
Helper I
Helper I

How to run a MDX query for all datasets available in workspace

Hi,

I have a premium workspace with multiple datasets. How can I run a simple MDX query (like SELECT * FROM $System.DISCOVER_M_EXPRESSIONS ) for all datasets available in that worksapce via SSMS (XMLA endpoint)?
The MDX runs for each dataset, now we have to run this for mutiple datasets and in multiple workspaces. 
Any advise or help is really appreciated. Thanks.

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi  @Krishanu ,

The following article have a solution about how to run dax or mdx queries against  Power Bi,you could have a look.

Can I run my own DAX or MDX queries against Power BI?

 

Wish it is helpful for you!

Best Regards

Lucien

 

View solution in original post

5 REPLIES 5
lbendlin
Super User
Super User

Assuming you can use the new-ish AAD based Power BI REST API custom connector you can do all this now in Power Query.

 

GitHub - migueesc123/PowerBIRESTAPI: A Microsoft Power BI Data Connector or Power Query Connector fo...

 

- collect all workspaces you have access to

- collect all datasets in these workspaces

- run MDX query against the datasets  (via the Analysis Services connector)

Yanant1020
Advocate I
Advocate I

I have this exact same need and we have lots of datasets. As far as I can tell the linked blog post that is five years old is likely working with limitations that do not exist anymore. Is there a better solution to this issue you have found? I need to be able to query ALL our published datasets on a schedule to retrieve information about them.

v-luwang-msft
Community Support
Community Support

Hi @Krishanu ,

Has your problem been solved, if so, please consider Accept a correct reply as the solution to help others find it.
 
Best Regards
Lucien
 
v-luwang-msft
Community Support
Community Support

Hi  @Krishanu ,

The following article have a solution about how to run dax or mdx queries against  Power Bi,you could have a look.

Can I run my own DAX or MDX queries against Power BI?

 

Wish it is helpful for you!

Best Regards

Lucien

 

lbendlin
Super User
Super User

You create linked server entities for all your datasets and then run a UNION ALL query.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors