Tag: OneDrive Refresh

  • Updating PBIX Files in SharePoint: Do’s & Don’ts

    Updating PBIX Files in SharePoint: Do’s & Don’ts

    I recently encountered a really frustrating experience related to a set of reports seeming to not update after some data source changes. I’d done this change before, and had another co-worker take on the task of updating some of the other reports in the same fashion. After a bit he reached out and explained that a few of the reports wouldn’t update while the others had… This was odd since we were making the same type of change. Queue hours of testing, changing, fixing one report without any idea how I did it, and then hitting a brick wall with the remaining two.

    The Setup: The data sources for the original reports were Excel spreadsheets stored in a SharePoint Online folder. The PBIX file connected to Excel files in SharePoint online using a Web connection. Once the reports were created, we stored the PBIX files in a separate SharePoint Online folder. Next, we opened the Power BI Service and connected to the reports directly from Power BI to a SharePoint team site, if you aren’t familiar with that process you can read about it in depth in an article that Mike Carlo wrote -> here. (The TLDR -> Get data -> Files -> SharePoint Folder -> navigate to folder -> Click on PBIX -> Connect)

    By connecting to the PBIX files from the PBI Service the dataset, report and dashboard for the report are loaded and sync’d. Where this comes in very handy indeed, is linking the SharePoint folder to your windows explorer and accessing the file, making changes, and saving the PBIX in that “local” location no longer requires you to re-publish the report from the PBIX and the changes make their way to the Service without any further work. I had made several changes to the reports from an asthetics perspective, and maybe added a new measure here and there, but hadn’t done anything drastic until just recently when we updated the sources. Due to some changes on the backend processes that were generating the Excel files, it became apparent that it would be easier for the Dev team if we used CSV files instead of xlsx. The team went through and changed the reports and 3 of the 5 reports we were working on broke in the Service giving this error.

    “Failed to update data source credentials: Web.Contents failed to get contents from” after updating data source

    At first, I thought it was the use of parameters in the report, but after determining that wasn’t the issue, it actually helped me figure out that the report in the Service wasn’t updating because the parameters were still showing the “xlsx” file type from the files that I had already removed from the SharePoint location. After repeated attempts to change the datasources manually in the original file, delete and replace, and every other combination of things to try a refresh, I was stumped. What was more confusing, is that connecting to the file again from the PBI Service created another dataset & report of the exact same name!

    In my mind, that wasn’t supposed to happen, and I was getting more frustrated because things were not behaving as I would expect. My initial assumption here was that the PBI Service would look at the new PBIX of the same name and recognize the changes and replace the existing dataset and report, the same way that it does if I manually push a PBIX via the “Publish” action. But using this direct connect method, refreshing the dataset did nothing…(cue the “grrrr”).

    The solution:

    Thanks to the fantastic Power BI team, they were able to determine my issue and share with me the root cause of some of the datasets not updating. The issue is that when you connect to the PBIX files in this manner, the PBI Service looks at the root id of the PBIX file in the OneDrive location and that file id cannot be deleted and replaced with another one. If you do that, you get the above error on the dataset source because it cannot find the file id. If you remove the file out of SharePoint then when you insert it back into the folder the ID will be different. This is what breaks the dataset in Power BI, and also the reason it allows what appears to be the same named dataset and report. However there is good news, because you are in SharePoint you will be able to go back in version history of the folder and pull the previous versions of the reports and resolve the issue in the datasets. I did end up having to replace one of the reports, but lucky for us it was only a single user for the customer report and re-sending a shared link was a really low impact compared to what it could have been.

    Here are the following guidelines I can offer up after going through this.

    Do:

    • Sync the SharePoint folder to your local storage
    • Open the report directly from the synced folder and update it in location
    • Leave the originals file in the folder and replace it with the new one
    • Do try to resurrect your previous version of the report PBIX in the folder (if you are hitting this issue now)

    Don’t:

    • Move the file to your local machine, then back to the SharePoint folder
    • Remove the file from the folder (You can do this if you move it to a SharePoint folder, update and move it back, but if the dataset refreshes during that time in the Service it will break and you will need to fix the credentials when you have put the file back.

    I hope you found this post worthwhile, error messages are hard to track down to the root causes and due to the nature of this being a tricky one for me to solve I thought I would share the experience and hopefully help others avoid it or solve the errors that match above.

    When testing out this issue again, I did uncover this error message which is much more specific. It came up after I made the breaking change, but prior to an automated refresh.

    “We are unable to locate the file on OneDrive for Business. Please check that the file exists in this location.”

    If you like the content from PowerBI.Tips, please follow us on all the social outlets to stay up to date on all the latest features and free tutorials.  Subscribe to our YouTube Channel, and follow us on Twitter where we will post all the announcements for new tutorials and content. Alternatively, you can catch us on LinkedIn (Seth) LinkedIn (Mike) where we will post all the announcements for new tutorials and content.

    As always, you’ll find the coolest PowerBI.tips SWAG in our store. Check out all the fun PowerBI.tips clothing and products:
    Store Merchandise

  • Best Practices for Sharing

    Best Practices for Sharing

    I’ve been using Power BI since it was released back in 2015, and I’ve found that when talking with other PowerBI users there is always a little confusion about how to share Power BI reports.  My experience has been that most people are first introduced to the service and go directly to PowerBI.com, login and start playing around.  They explore a little and find a cool data source to connect to, such as a SQL database or some good old google analytics data.  Typically they will begin making a dashboard and really get into making visuals on a report.

    While this is an excellent way to get started because this removes the complexity of having to model your data, it does come with some challenges that leads to issues later on.

    1. There comes a point in time that the user usually needs some additional data.  The “this is good data but, if I could only join the data with another source….” question almost always comes up.
    2. These reports are typically made in your personal workspace which is not a good solution for sharing a report with another user.  I’ll explain later.
    3. How do I source control this document?  What if I want to go back in time and restore my changes?

    In order to answer these questions, I’ll show you what I use to get around these issues.

    To start off, and most importantly!, try to refrain from building your dashboards in the PowerBI.com service.  Yes, you can do it, but it is not recommended.  I don’t recommend this because any report created in your personal workspace can only be edited by you and no one else.  Also, if your account is deleted or you loose access to your account no other PowerBI user can modify your original report.  It’s the classic, win the lottery, or hit by a bus case, depending if your an optimist or pessimist.  What you should do instead, is download and open up the PowerBI desktop application.  This will save you ton’s of headache later when you want to join multiple data sources or want to have a saved copy of your Report.

    After you download the desktop application you will load the data using the Get Data button found on the Home ribbon.

    Get Data Button
    Get Data Button

    Almost, all data sources found in the Get Data window are on the PowerBI.com service.  You will notice this changes over time, with each monthly release of PowerBI desktop.

    FYI, I have noticed that changes happen faster in the PowerBI.com service as it appears as though there are weekly or bi-weekly updates. But the Desktop version is slightly slower to get changes as builds are only released once a month. 

    Get Data Window
    Get Data Window

    Next you will load data into the Power BI desktop.  If you want to learn more about modeling you can browse through these tutorials on data modeling.  Modeling happens in the query editor with the M language, and on the report pages using DAX.

    Now we will create a very simple PBIX file to publish to the PowerBI.com service.

    On the Home ribbon click the Enter Data button and enter the following:

    Create Table of Data
    Create Table of Data

    This will create a simple data table.  Click Load to bring the data into PowerBI Desktop.

    Create a visual by clicking on the Stacked Column Chart and adding the following columns to the visual.

     

    Add Column Chart
    Add Column Chart

    Congratulations, we have completed a very simple report and you have loaded data inside the desktop.  In addition to loading data PowerBI is equipped with a robust modeling tool called the Query Editor.  The very topic of modeling your data is a huge.   It covers the Query Editor, making DAX expression and has been covered in numerous books.  This this post will not address modeling your data.  As a side note, here are some really good sources of information for learning more about DAX.

    Check out SQL BI.com from Marco Russo is a real genius and an excellent teacher. His site is amazing.

    Another good source of modeling tips and all kinds of other goodies the Radacad Blog from Reza Rad.

    Alright, let publish this bad boy.  First save the Report.  Do this by clicking File then click Save.  Enter a simple name such as Sample Report, click Save.

    Save File
    Save File

    To publish the report to the PowerBI.com Service click the Publish button found on the Home ribbon.

    Publish Button
    Publish Button

    If you have not already signed into the PowerBI.com service you will be prompted to sign in.

    Sign In Screen
    Sign In Screen

    If you already have a more than one workspace in the PowerBI.com service a second window will pop up asking you to choose a workspace location. Choose a workspace location to publish the report.

    Choose a Workspace
    Choose a Workspace

    Couple of important notes about workspaces.

    1. A workspace can have admin users or members.  The admin user can add and remove individuals to the workspace.  A member can be configured to either, edit reports, or only view reports.
    2. The workspace can have many admins if necessary which is helpful when collaboratively working on reports with a team.
    3. I have found that when working on many different reporting projects a workspace helps target a specific audience or provides an organized method to share only reports that would be relevant.
    4. You cannot create a workspace in this Publish to Power BI window.  This has to be done from the service.

    Since I am not sharing this report I will publish to My workspace. Click Select to complete the publishing.  Once the report is done loading you will have a window that notifies you that the process has completed.  A link is provided to check out your report directly on the service.  You can dismiss the message by clicking Got it.

    Link to Report
    Link to Report

    Click Got it to dismiss the pop-up window.

    While remaining in PowerBI desktop, save the file one more time but use SAVE AS and save the file with the name of  Sample Report V2.

    Now we will create a new workspace for a report that we might want to share.

    Go to PowerBI.com and login. On the left navigation bar click the arrow to expand the workspaces.

    Open Workspaces
    Open Workspaces

    A fly-out menu will appear and you can click Create App Workspace.

    Create App Workspace
    Create App Workspace

    Fill out your workspace name and configure your settings.  Be sure to enter your email address that you used to log into the PowerBI.com service in the workspace members area.

    Create Workspace
    Create Workspace

    At the bottom of the menu click Save when you have completely configured the settings.  Opening up the workspaces fly-out menu will now reveal your new workspace.

    App Workspace
    App Workspace

    Click on the ellipsis of the new workspace PowerBI-test.

    Click on Ellipsis
    Click on Ellipsis

    Notice when you click the ellipsis, that there are only two options, Edit and Leave.  If you give it about 10 minutes or so, a third option will show up, Files.  The reason we have to wait is because behind the scenes this workspace is tied to 0365 Groups.  Thus, we have to wait for all the services to be fully provisioned before we can proceed.   We will want to use the files option of our workspace.  Now would be a good time to take a little potty break, pet your dog, get a snack… and come back in 5.

    Yumm, I love Oreos…

    Now that we have waited a bit, Refresh your browser page.  This is important, if you don’t do this you won’t be able to observe the change.  Click the ellipsis again and now we have a new item called Files.

    Workspace Files
    Workspace Files

    Click on Files and you will be re-directed to a custom SharePoint 0365 page for this workspace’s files.

    Now we can upload the version two of our PBIX file.  Click the upload button on the navigation bar.

    Upload File
    Upload File

    After uploading your file it should look like the following:

    Loaded File
    Loaded File

    Go back to PowerBI.com, make sure you are still in the created workspace, then click Get Data at the bottom of the left navigation bar.  Then click Get in the Files window.

    Get Files Screen
    Get Files Screen

    Then a screen will pop-up showing you which source you can use to get data.  Click the title labeled OneDrive. 

    Get One Drive Files
    Get One Drive Files

    Upon clicking this we are taken to the OneDrive location that we created with the workspace.  In here we will have the Sample Report V2.pbix file.  Click the name of the file Sample Report V2.pbix.  Then click Connect to load the file.

    Note: If you want to make changes to the pbix file you have to overwrite the file in the OneDrive location.  Don’t worry, SharePoint does have version control on the files. This will keep the files location nice and clean.  It also removes the need for you to version or date each and every file.  To learn more about versioning files in SharePoint hit this link.

    Now when we click on the workspace PowerBI-test we can see that the dataset, report, and dashboard has all loaded.

    Workspace
    Workspace

    There are some advantages of loading your pbix file this way.

    1. loading a file from OneDrive will automatically refresh the report every hour from the pbix file.
    2. OneDrive provides version control for your file.
    3. If any team members want to modify the original file the members of the workspace can access the file from the SharePoint page.

    Click on the Ellipsis of the Sample Report V2 under the DATASETS section and select Schedule Refresh from the fly-out window.  You will notice just under schedule refresh is a new setting called OneDrive refresh.

    OneDrive Refresh
    OneDrive Refresh

    Click OneDrive Refresh, and now you can see there is a toggle for keeping the file refreshed every hour, which is enabled by default.

    Hourly Refresh
    Hourly Refresh

    Whew, I think that about wraps it up, start with the desktop to make your files, be sure to create workspaces to share content, and use the workspace files to store and source control your pbix files.

    I hope it was helpful.. Make sure you share this blog with another person if you found it valuable.