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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
YuriNayder
New Member

Programatically Renaming Datasets

I have a requirement where I need to take a CSV report that is created via Scheduled Task on a Windows Server and write the rows to a PowerBI dataset daily.  Once I have moved the data to a PowerBi dataset the PowerBI devs take over.  This report is run Monday through Friday, and I need to retain 30 days.

 

I have a PowerShell script written where I can create the dataset daily and move the data in to the dataset.  My script names the dataset as "Report_MM-DD-YYYY".  The requirements changed while I was working on it, so now I need to find a way to rename daily the datasets consistently, where today's report is always named "Report_1" and the oldest is always "Report_30".  Is there any way to rename datasets programtically?  I have everything working in PowerShell except the actual renaming of the datasets, I can query and delete the oldest etc.  I'm just stuck on the renaming to keep the datasets consistent to the reports they are linked to.

 

I'm more of a SysAdmin helping the PowerBI team.  PowerShell is the only approved method I can use fro mthese server to write to a PowerBI dataset.  I can't give the PowerBI team access to the server generating the report, so I have to push it out.

 

Any ideas?

 

5 REPLIES 5
GilbertQ
Super User
Super User

Hi  @YuriNayder 

 

I am not 100% sure that it would work in the way with the semantic model (dataset) being renamed as the reports connect via a GUID and not the actual name.

 

I would think the process needs to be thought out and more robust for this to work as expected.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

YuriNayder
New Member

I think I misstated the issue.  I don't need to clone the report, I need to clone the dataset a report is built off of.  If I'm thinking right, updating the dataset's name daily would be transparent, the report will just connect to the new dataset and refresh it's data.  Unfortunately, it's a high secuirty environment so my options are limited.

GilbertQ
Super User
Super User

Hi @YuriNayder 

 

What I will do is the following. I would first create new. semantic models with the reports 1 through 30. Then what I would do in my Powershell script is to first process clear the report for the date that I'm looking to use. This would essentially truncate the data in that semantic model or dataaet. Next I would then update the data in this report where it would query from your source.

 

The only other way that this could be done is by deleting the current report creating a new report with the name in its place.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Thanks for your input.  I looked at deleting each report daily, and recreating with an incremented number.  However, unless I'm doing somehitng wrong, it takes about 8 hours to write the ~25000 new lines in the daily report to PowerBI.  So recreating daily looks like it will take longer to recreate them all than I have in the timeframe to do so.

 

I read a reference to cloning the data set with a new name, but I see nothing in the PS commands for PowerBI that allow me to do this.  I also saw that possibly updating the propertiees of the dataset via REST API is an option, but I get a bad request error no matter what I ry to pass it.

 

So just so I'm clear, PowerBI is the one product Microsoft has that doesn't allow for something as simple as changing the name of an object?

Hi @YuriNayder 

 

Here is the clone API which you could use?

Reports - Clone Report - REST API (Power BI Power BI REST APIs) | Microsoft Learn

What you could do is to upload the new report and then clone it?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.