Forum Discussion

lauriedata's avatar
lauriedata
Resolver I
10 months ago
Solved

error that column doesn't exist when it does

I have a table that had deleted columns somehow.  I re-created the table using tmdl.  The table showed in the table/model views and all the fields are there.  But when I tried to add fields from that table to a view, I kept getting the error that shows below in the attached pic.  

 

I then deleted the table and re-imported the table and started my visuals from scratch.  I still am getting the same error that any field I try to add doesn't exist "in the current context".  But they all exist.

I tried clearing the cache, that did nothing. 

I then created the table as a query (called query 1), instead of a table, and it works.  

Why is it rejecting anything that is created under the original table name? I'm baffled.  Any ideas? 

 

 

  • Thank you.  This is basically all the steps I had taken.  I tried a second time and it worked. Basically, what worked was starting from scratch, which isn't really a solution.  I wonder if anyone has discovered a reason for this occurring.

     

2 Replies

  • Hi lauriedata 

     

    I encountered the same issue, and here’s what worked for me:

    The problem happens because Power BI keeps a cached reference to the old table, even after deletion and re-import. Any relationships, measures, or visuals that pointed to the old table can cause the “field doesn’t exist in the current context” error.

    Steps to fix it:

    1. Delete the problematic table completely from the model.

    2. Clear the cache:

      • Go to File → Options and settings → Options → Data Load

      • Click Clear cache and restart Power BI.

    3. Re-import the table but give it a new temporary name (e.g., TableName_New).

    4. Check and remove broken relationships or measures that referenced the old table.

    5. Rebuild your visuals from scratch if needed.

    This completely resets the metadata and solved the issue for me.

    Hope this helps!

    • lauriedata's avatar
      lauriedata
      Resolver I

      Thank you.  This is basically all the steps I had taken.  I tried a second time and it worked. Basically, what worked was starting from scratch, which isn't really a solution.  I wonder if anyone has discovered a reason for this occurring.