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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
jja
Helper III
Helper III

duplicating table fails

Hi

 

I have a stored procedure inside SQL that generates a #temptable

i can load this procedure intio powerbi and i get my table

for other task i need to unpivot this table and i tried to reference and duplicate the original table using powerquery editor

 

When refreshing dataset i get error on generating duplicate table that it can not find #temtable. IT seems the duplicate or reference or if i script directly to get the table copy using M anyway inokes sql procedure and i have no idea why it says it can not find this #temptable?

One strange thing i have in this setup is that when calling this procedure from powerbi in front i need to script drop #temptable else powerbi screams the object already exists.

What am i doing wrong in this scenario? maybe there is a way to clone and unpivot loaded table without calling the source sql procedure?

1 ACCEPTED SOLUTION

I found how to solve the issue. IT was wrong choice in sql procedure to use global temp tables. I switched to local temp tables and then i can run the procedure twice in data enquery

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@jja 

 

Please share the code so we can see what happens in your model.

You may read this article see if helps: Chris Webb's BI Blog: Why Is Power BI Running My SQL Query Twice? Chris Webb's BI Blog (crossjoin.co...

 


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

Jimmy801
Community Champion
Community Champion

Hello @jja 

 

could you share some M-code and tell us where you are referencing your SQL twice?

 

BR

 

Jimmy

I found how to solve the issue. IT was wrong choice in sql procedure to use global temp tables. I switched to local temp tables and then i can run the procedure twice in data enquery

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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 Kudoed Authors