Forum Discussion

jklkj's avatar
jklkj
Frequent Visitor
3 years ago

Delete data from PowerBI Desktop Model

Dear all,

 

We are currently working on developing a tool that deletes data from PowerBI Desktop before the business users save it to TFS.

However, we have encountered two issues that we are struggling to resolve and we were hoping you could provide us with some assistance.

 

Our tool has been developed with the following prerequisites:

 

  • PowerBI Desktop (for Power BI Report Server)

 

  • Windows Server 2019 Standard

 

  • Windows PowerShell ISE (as administrator)

 

 

Issue 1

 

Our first issue is related to data deletion. We initially approached this by connecting to the Analysis Services workspace created by PowerBI Desktop,
finding the appropriate port, and then using PowerShell to connect to it and delete the data using the "Invoke-ProcessTable" function.
This method worked without any problems until we started using PowerQuery Groups.

 

What is the task:

The task is to be able to delete data from a PBIX file by Powershell, even when PowerQuery groups are used.

 

Working Solution:

We use PowerShell to open the PBIX file and find the port to the Analysis Services workspace that is created in the background.
As the server name, we use localhost:<port>. We have an iteration which deletes all tables in a database. We delete the data using the "Invoke-ProcessTable" function.

 

Not Working Solution:

This was the working solution to delete data from the Power BI model, but we encountered a problem when we started using PowerQuery groups.

 

Error Message:

Question:

How can we delete data while also utilizing PowerQuery groups?

Issue 2

 

Our goal is to ensure that once the data is deleted, it remains deleted even after saving and closing the PBIX file.
Currently, however, we've encountered an issue where the deleted data reappears when we reopen the file.
As such, we're looking for a solution that will allow us to permanently remove the data from the file, so that it does not return upon reopening.

What is the task:

Our goal is to have a PBIX file without any data permanently, once the data has been successfully deleted.

 

Not Working Solution:

Our initial approach for addressing the issue of data persistence was to simply save and close the PBIX file after deleting the data using PowerShell.
However, this solution did not prove to be effective in achieving our goal of permanently removing the data from the file.

 

Question:

How can we ensure that the deleted data is not restored when we save and close the PBIX file?

 

6 Replies

  • bcdobbs's avatar
    bcdobbs
    Community Champion

    Hi,

    Have you considered going down the thin report/connected dataset approach?

     

    You then work on a json bim file (or soon TMDL) and deploy it to an XLMA end point. This is simply a definition of the model and contains no data. Plays really nicely with source control.

     

    Your report pbix files then connect to the dataset in the service and so also don't contain data themselves.

     

    The other option is to save as pbit which is exactly what you're looking for in that it is the report, the data model but no actual data.

  • jklkj's avatar
    jklkj
    Frequent Visitor

    Hi Ben,
    thank you for you reply.

    Can I use XMLA endpoint for PowerBI Report Server (on-premise PowerBI)?
    Is there any way how to automically (e.g. using PowerShell) update PBIT back to PBIX file?

    Thank you.

  • jklkj's avatar
    jklkj
    Frequent Visitor

    I have considered your response, and I am still unsure of how to deploy a BIM file to the Power BI Report Server in an on-premise environment without internet access. Everywhere I have researched, it only discusses the Power BI Service, which is not utilized nor permitted by the company I work for. Therefore, I did not consider this option from the outset. Could you please provide me with a link where I can find more information, ideally a procedure for automatically deploying a BIM file to PBIRS? Thank you.