Forum Discussion

dhruv_-_'s avatar
dhruv_-_
New Member
8 months ago
Solved

SQL Direct Query Error

Hi all,
I’m using SQL Server with DirectQuery, and after adding new columns to some tables, Power BI started showing:
“Invalid column name” for the newly added columns.
What’s strange is:
  1. The new columns appear correctly in Power Query
  2. Refresh fails only in DirectQuery
  3. Import mode works without any errors
  4. If I delete all tables and reconnect the DB from scratch, and re-write all the measures it works again
  5. The same PBIX works on one colleague’s laptop but fails on another
Schema is identical across environments.
Any idea how to fix it without rebuilding the whole model?
Thanks!
  • Anonymous's avatar
    Anonymous
    8 months ago

    Hi dhruv_-_ ,

    Try these before rebuilding to fix the issue.

     

    1. clear file-specific cache.

     

    File → Options → Current File → DirectQuery → Clear cache

     

    Restart again.

     

    2. Disable SQL Server folding cache

     

    Go to:

     

    File → Options → Global → Preview Features

    Disable:

     

    Improved model metadata

     

    DirectQuery query reduction (if enabled)

     

    Restart Power BI.

     

    3. In Model View, for each affected table:

    Select table,

     

    Click Refresh in the Properties pane (this is a metadata refresh, not data refresh)

     

    OR

    Remove one column and add it back (forces schema reload).

     

    4. In Model View, for each affected table:

    Select table

    Click Refresh in the Properties pane (this is a metadata refresh, not data refresh)

    OR
    Remove one column and add it back (forces schema reload).

     

    5. Ensure all machines use the same Power BI Desktop version

     

    Some versions had DirectQuery metadata bugs.

     

    If my response as resolved your issue please mark it as solution and give kudos.

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi dhruv_-_ ,

    Try these before rebuilding to fix the issue.

     

    1. clear file-specific cache.

     

    File → Options → Current File → DirectQuery → Clear cache

     

    Restart again.

     

    2. Disable SQL Server folding cache

     

    Go to:

     

    File → Options → Global → Preview Features

    Disable:

     

    Improved model metadata

     

    DirectQuery query reduction (if enabled)

     

    Restart Power BI.

     

    3. In Model View, for each affected table:

    Select table,

     

    Click Refresh in the Properties pane (this is a metadata refresh, not data refresh)

     

    OR

    Remove one column and add it back (forces schema reload).

     

    4. In Model View, for each affected table:

    Select table

    Click Refresh in the Properties pane (this is a metadata refresh, not data refresh)

    OR
    Remove one column and add it back (forces schema reload).

     

    5. Ensure all machines use the same Power BI Desktop version

     

    Some versions had DirectQuery metadata bugs.

     

    If my response as resolved your issue please mark it as solution and give kudos.

  • hi dhruv_-_ 

    try changing the column name to something unique and then try.If this works, then there could be chances that you have renamed the column directly in desktop and its conflicting with it.

    another option you can try is uncheck Enable Data load option in power query and close and apply.this will remove the table from desktop.then again check the Enable Data load option in power query and close and apply.

     

    Please give kudos or mark it as solution once confirmed.

     

    Thanks and Regards,

    Praful

  • v-priyankata's avatar
    v-priyankata
    Community Support

    Hi dhruv_-_ 

    Thank you for reaching out to the Microsoft Fabric Forum Community.

    Kedar_Pande Anonymous kushanNa Praful_Potphode Thanks for the inputs.

    I hope the information provided by users was helpful. If you still have questions, please don't hesitate to reach out to the community.

     

    • v-priyankata's avatar
      v-priyankata
      Community Support

      Hi dhruv_-_ 

      Hope everything’s going smoothly on your end. I wanted to check if the issue got sorted. if you have any other issues please reach community.