Forum Discussion

viswaaa's avatar
viswaaa
Icon for Helper IV rankHelper IV
1 year ago
Solved

Import to direct query mode

Hi Team,

 

I created a report using import mode, and I want to change that a direct query.

Could anyone suggest how to change this

  • Hi viswaaa  - Unfortunately, you cannot directly switch a Power BI report from Import mode to DirectQuery mode.

    again, you have to rebuilding the model using DirectQuery.

     

    suggest, You can open both your old (Import) and new (DirectQuery) files side by side to copy DAX, visuals, and structure more easily for quick implementation.

     

    Hope the above information helps.

  • This means the transformation cannot be folded back to the source database. So, even if you switch back to DirectQuery, you must either remove the steps that break query folding or modify them to use operations that support it. Note: not all Power Query transformations have a DirectQuery-compatible equivalent.

10 Replies

  • Hi viswaaa 

     

    This is possible in the TMDL view.

     

    Right click a table. Select Script TMDL to >> Script tab

    Look for mode: import. Change import to directQuery. Then apply the changes. You will be asked to refresh the  table after.

     

     

    • viswaaa's avatar
      viswaaa
      Icon for Helper IV rankHelper IV

      Hi danextian ,

       

      Thanks for this approach.

      After doing this I am getting below error.

       

       

      • danextian's avatar
        danextian
        Icon for Super User rankSuper User

        This means the transformation cannot be folded back to the source database. So, even if you switch back to DirectQuery, you must either remove the steps that break query folding or modify them to use operations that support it. Note: not all Power Query transformations have a DirectQuery-compatible equivalent.

  • Hi viswaaa  - Unfortunately, you cannot directly switch a Power BI report from Import mode to DirectQuery mode.

    again, you have to rebuilding the model using DirectQuery.

     

    suggest, You can open both your old (Import) and new (DirectQuery) files side by side to copy DAX, visuals, and structure more easily for quick implementation.

     

    Hope the above information helps.

  • Hello viswaaa 

    Open your existing .pbix file.

     Go to Home > Transform data > Data source settings.

     Clear permissions for the source (optional, if you want to reconnect).

     In Power Query, remove the imported tables.

     Go to Home > Get Data, connect to your data source again.

    This time, choose DirectQuery instead of Import.

     Rebuild relationships and visuals (if needed).

     

    You can explore details here

    Solved: How do I change a query from Import to Direct Quer... - Microsoft Fabric Community

    Thanks,
     Pankaj Namekar | LinkedIn

    If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

  • v-sdhruv's avatar
    v-sdhruv
    Icon for Community Support rankCommunity Support

    Hi viswaaa ,
    The error "unable to convert an M query in table Query1 into a native source query" usually means Power BI (or Power Query) cannot "fold" your M code back into a native SQL query for the underlying data source (like SQL Server, Snowflake, etc.)

    You can't change from Import to DirectQuery mode. You can switch from DirectQuery mode to Import mode if you import all the necessary data. It's not possible to switch back, mostly because of the feature set that DirectQuery doesn't support. DirectQuery models over multidimensional sources, like SAP BW, can't be switched from DirectQuery to Import mode either, because of the different treatment of external measures.
    Refer-
    https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-use-directquery#other-directquery-limitations
    If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank You

    • danextian's avatar
      danextian
      Icon for Super User rankSuper User

      It is possible to switch back to DQ using TMDL as long as the transformations applied can be folded back to the database.

  • v-sdhruv's avatar
    v-sdhruv
    Icon for Community Support rankCommunity Support

    Hi @viswaaa ,
    Just wanted to check if you had the opportunity to review the suggestion provided?
    If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank You

  • v-sdhruv's avatar
    v-sdhruv
    Icon for Community Support rankCommunity Support

    Hi @viswaaa ,
    Just wanted to check if you had the opportunity to review the suggestion provided?
    If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank You