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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Python pop up message showing up multiple times

Hi!

 I made a script that checks if a table is empty or not, and if it's empty, a pop up message shows up. The problem is that the message shows up like 5 or 6 times, instead of just one. I couldn't find the solution or even the cause of this problem. 

(What I really wanted to do in the first place is to evaluate if theres content in that table, and if it's empty, ommit it's visualization, or hide it's page, but couldn't find how, so for now I'm using the pop up, but I would take one of these as a solution as well).

 

Here is an example of my code:

 

if len(dataset['Accounts']) == 0:
      win32api.MessageBox(0, 'Accounts not found. Visualizations will not load correctly', 'Warning')

 

 I don't understand why it's getting executed some many times.

 

 

Thank you in advance!

2 REPLIES 2
lbendlin
Super User
Super User

I got some bad news for you I am afraid.  There is no guarantee whatsover that Power Query will run your code only once.

 

Chris Webb's BI Blog: Why Is Power BI Running My SQL Query Twice? Chris Webb's BI Blog (crossjoin.co...

Anonymous
Not applicable

Oh, I see. I read the article. It seems that isn't just an issue with python. I'll try to find another way then.

Thank you!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.