Disclaimer: The method described in this post includes modifying Power BI file (PBIX) outside of Power BI Desktop. It is highly recommended to take a backup of your PBIX file beforehand. It’s highly probable that you corrupt your PBIX file if make a mistake when following the method described here. So please follow the process on YOUR OWN RISK!
Custom visuals are awesome. It’s easy to import them to Power BI Desktop model and start using them. But, what if you decide to remove them from your model? Is there a way to disable an imported custom visual?
Well, the answer is No and Yes! I mean, NO, there is no specific setting or option you can manage imported custom visuals in Power BI Desktop. But, YES, there is a way you can get rid of an existing custom visual. In this article I show you how to do the job.
First of all, I’d like to inform you that Microsoft will add the feature to disable custom visuals in Power BI Desktop, but, until then you can follow the my trick to completely disable/remove a custom visual from your Power BI Desktop model.
As you might already know a PBIX file is a compressed file indeed, so you can open it with a ZIP editor software like 7-Zip.
- Download and install 7-Zip. It’s a free open source file archiver/compressor
- Download and install Notepad++ which is also free and open source. It’s an awesome text editor
Removing/disabling Custom Visual
- Open you Power BI Desktop model (PBIX file) containing a custom visual
- As you see you need to enable custom visuals, click “Enable custom visuals”
- I used “KPIStatusWithHistory” custom visual in my sample model
- As a new KPI visual released by Microsoft I don’t need the custom visual anymore. So I replace the “KPIStatusWithHistory” with the “KPI” visual.
- In your case you might want to do the same or you might want to completely remove the custom visual from your model
- Save the model after making the corresponding changes
- Close Power BI Desktop
- Reopen the PBIX file
- As you see you although you replaced/removed the custom visual you still get the “Enable custom visual” warning message on top of the report
- The reason for that is that Power BI Desktop imports the custom visuals to the model, so although we replaced the custom visual with a default visual, we still get the warning message on top of the report. So we need to remove the custom visual from the model
- Close Power BI Desktop
- Browse the folder containing the PBIX file
- Right click the PBIX file
- Click 7-Zip –> Open archive to open the PBIX in 7-Zip
- Double click “Report” folder
- Right click on “CustomVisuals” folder then delete
- Now double click on “Layout” file to open it
- Windows will ask you how to open the file you select Notepad++
- On Notepad++ click “View” menu then tick “Word wrap” to see the file content tidier
- Press “Ctrl + F” to open “Find”
- Search for “,”resourcepackages”” without RED quotation marks
- Select “,”resourcePackages”:[” and whole text after it down to close bracket. If you use Notepad++ it’s easy to find the close bracket as it highlights it. You can also search for “,”sections”:” and you can find the close bracket right before it.
- Delete the selected text
- “Save as” the “Layout” file in your local drive
- Remember that the “layout” file doesn’t have any file extension. So if Notepad++ added a default text file extension when saving remember to remove it
- Now drag and drop the file to 7-Zip and replace the existing “Layout” file with the new one
- Close 7-Zip
- Open the PBIX file
As you can see we successfully removed the custom visual from the visualisations. We also got rid of the “Enable custom visual” warning message on top of the report.
Note: You might think of changing the file extension from PBIX to ZIP then open the file normally in Window Explorer. It would be OK for the first part of the job explained so far, but, you might corrupt the file if when replacing “Layout” when browsing the ZIP file with Windows Explorer.
Note: I used 7-Zip with default compression settings. If you change the compression level to anything other than “Normal” it’s highly probable that you corrupt the PBIX structure. Therefore you won’t be able to open it again. This process can also be done using native Windows zip file explorer.