Incredibly, after developing Power BI Desktop for over 2 years, there is still no way to undo a change in the Query Editor window. Your only options are:
- manually change all the Queries back to exactly the same state they were in when you opened the Query Editor. This sometimes works.
- close the file without saving.