Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

sql query against imported table in semantic model

can I run a sql query against data imported into the semantic model in power bi desktop
  • BA_Pete's avatar
    1 year ago

    Hi Anonymous ,

     

    The short answer is no, you can't query model data using SQL within Power BI Desktop. PBI models use the tabular structure and are optimised for DAX and MDX queries.

    However, depending on your use-case, you may be able leverage Datamarts, but you've not provided enough information to understand whether this is feasible/appropriate or not:

    https://learn.microsoft.com/en-us/power-bi/transform-model/datamarts/datamarts-analyze 

     

    Pete

  • rohit1991's avatar
    1 year ago
     

     

    No, you cannot run SQL queries directly on imported data in Power BI’s semantic model. Instead:

    • Use DAX queries (via DAX Studio or Analyze in Excel) for querying.

    • Use SQL in Power Query before importing data.

    • In DirectQuery mode, write SQL queries to retrieve data from the source.

    • For Pro/Premium, use XMLA endpoints for external querying.