Welcome to July! This month we have Tommy Puglia from the Chicago Power BI User Group joining us to discuss and talk about driving organizational success with Power BI.
Tommy is an expert and has spent years deploying Power BI within various organizations. Check out the video below from the July 2020 Milwaukee Brew City Power BI user group.
If you like the content from PowerBI.Tips please follow us on all the social outlets. Stay up to date on all the latest features and free tutorials. Subscribe to our YouTube Channel. Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.
Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:
A common ask from users is the ability to view data related to visuals in excel. While there is an option to export data, the format is often unfriendly and has limitations. What’s more, this data becomes disconnected and is not updated if a user looks at after the data is refreshed.
This post will explore a way to add a pre-built excel report that can be designed in advance with company branding and advanced features or VBA. Additionally, it will be linked to the report’s data model via live connect. This means it will continue updating if reopened, as well as maintaining Row Level Security.
End Result
The end result will be a download button that can open a well designed excel report.
Video
This content was demonstrated at the Milwaukee Brew City User Group in February 2020. You can watch the video recording and see the steps detailed below.
Step 1 – Connect to Excel
There are two ways to connect:
Option 1: This option may not be available to you depending on your office license.
Open Excel and navigate to the data tab. Click Get Data the select “From Power BI dataset”. From the list, select the report that contains the model.
Option 2:
The other way is to navigate to the service (app.powerbi.com) and open the report that contains the model. Click the ellipsis and select Analyze in Excel.
This will download a file which has the extension “ODC”, which stands for Office Data Connection. This file contains information that will tell excel how to connect to the dataset on the service.
Click on the file to open in excel. Once opened, Excel will present you with an empty PivotTable. If you check the PivotTable fields you will notice that you can now see the fields and measures. The same ones which were created in your Power BI model.
We have now live connected to the model we have published in Power BI service. This works the same as using a live connection in Power BI. Your Excel file has access to all the logic and data is updated as soon as the model is updated. Refreshing the data source in Excel pulls the latest data directly from the Power BI model.
Step 2 – Develop a report
The PivotTable in the report is an OLAP (Online Analytical Processing) PivotTable and has a few differences from standard PivotTable made from flat data.
Just like Power BI, dimensions from multiple tables can be used in the same PivotTable. The relationships set up in the model will be observed.
Only explicit measures may be used in the VALUES section of the PivotTable. This means that unlike Power BI, you cannot drag a numeric column into VALUES and select a summarization (also known as an implicit measure). All values must have a specific measure written in the model file (or use an extension OLAP pivot table tools).
The PivotTable sends a new query each time some element in Excel is changed. For example, if you apply a filter, Excel will send a new query to the model. This works similar to the Direct Query mode in Power BI.
Now we have a connection set up, you can make a pre-defined
report that you can give directly to your end users.
You can add a slicer by clicking on the PivotTable, click on the PivotTable Analyze tab and select Insert Slicer (or use Timeline for dates).
There are many advantages of using a live connection.
The Excel file can be branded with company logos
Pre set filters can be added.
More advanced features such as Data Solver, VBA and macros can be added.
In addition, the data can be updated inside the workbook, or set to be refreshed on open. Users will also be prompted to sign in and authenticated through their Office account. Features such as Row Level Security will continue to work.
Keep it FRESH
You can set the report to refresh every time it is opened. Navigate to the Data tab and click “Queries and Connections”.
There will be one query, usually starting with pbiazue://. Right click this query and select properties.
From here you can enable “Refresh data when opening the file”.
Step 3 – Upload the excel
Now, that the excel is created, you can distribute it to end users. A helpful way is to create a download link directly in the report.
A good place to host this would be SharePoint – you can link
a SharePoint site directly to the Power BI workspace. It is secured through
Active Directory, plus if users are already logged into Power BI they do not
need to sign in again.
First, navigate to the online SharePoint location where you wish to host and upload your excel file.
Next, right click the file, and select download. This will download the file back to your local machine.
Now, navigate to your browser’s Downloads page. You can access through the settings of the browser, or if you are on a Windows machine, most browsers you can use the shortcut Ctrl-J. From here you will see the file you just downloaded. Right click the link and select what resembles “Copy link”. This may vary depending on the browser:
Chrome:
Edge:
Firefox:
Save the link you have copied to be used later.
Step 4 – Adding to the Report
For my download button, I am just using a down arrow image which I downloaded from an open license image site
In Power BI Desktop, open the Insert tab and select Image. Select the image you wish to insert.
After it has been added, select the image and open the visualizations pane. Turn on Action and change type to web URL. Then paste in the URL (the direct download from SharePoint) you saved earlier.
To tidy it up, I will add it next to the related visual. My visual has a text box above it. I have left some white space for a download button.
Step 5 – Using the button
Now, users can navigate to the report and click the download button. This will download the pre-built excel file. Users will be required to sign in and Row Level Security will still apply. In addition, users can use the “Refresh” button in the data tab to refresh data directly from the connected report.
Due to this being a Live Connection users will be required to enable content. In addition, they will need to sign into excel so that they can authenticate to the data model.
Tips and Tricks
Large tables will still need to send DAX queries
for each value, so make sure the DAX is efficient.
If using CUBE formulas, these are sent as
individual queries to the model. Try to use a single pivot table rather than
multiple formulas where possible.
Slicers are useful, but can slow down reports, especially if you have many. One way you could speed it up is by right clicking on the slicer and going to slicer settings. Then untick “Visually indicate items with no data”. This will now always show all items in the slicer – even if there is no data associated with it. While this is less helpful, it can often dramatically speed up reports.’
Download OLAP PivotTable Extensions (https://olappivottableextensions.github.io). This is an amazing extension that can help see information about OLAP PivotTables. The functions are detailed on the website, but two features which are worth calling out:
Ability to see MDX query – this shows the query that is sent to the cube for the PivotTable
Ability to add calculations – you can add measures (written in MDX) to the specific PivotTable without having to add it to the cube
If you like the content from PowerBI.Tips please follow us on all the social outlets. Stay up to date on all the latest features and free tutorials. Subscribe to our YouTube Channel. Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.
Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:
This month we are trying something brand new. We are introducing a new series called MVPs react. As you may already know Power BI has monthly desktop releases. If you are as excited about these releases as I am I love talking about all the new features. So, why not get a fun group of MVPs together to discuss everything.
These events are similar to a fire side chat about Power BI among the best experts within the community. We hope you enjoy the conversation, and learn a couple new things as well.
Here is our session for the Power BI desktop release for July 2020.
If you like the content from PowerBI.Tips please follow us on all the social outlets. Stay up to date on all the latest features and free tutorials. Subscribe to our YouTube Channel. Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.
Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:
If you haven’t heard about DAX Studio, well now you have. DAX studio is an essential tool for Power BI developers. It enables you to explore and tune your tabular model with ease. This month we are pleased to have the creator of this tool Darren Gosbell present to us the latest updates for DAX Studio.
DAX Studio has just released it’s latest version 2.11.1. With this release comes a number of great improvements.
If you like the content from PowerBI.Tips please follow us on all the social outlets. Stay up to date on all the latest features and free tutorials. Subscribe to our YouTube Channel. Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.
Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:
This month’s Milwaukee Power BI User group we have Reza Rad from Radacad.com. Reza has a long history within the Power BI MVP community. His presentation this month is about how to use dataflows and shared datasets.
Check out the recorded session below.
Discounts on Training
Like Reza’s training, visit the additional learning materials from Reza. Use the discount code “PowerBITips” to receive a $30 discount on your first month of training. Get the training: https://learn.radacad.com/product/academy-membership/
If you like the content from PowerBI.Tips please follow us on all the social outlets. Stay up to date on all the latest features and free tutorials. Subscribe to our YouTube Channel. Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.
Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:
I am working on a project that uses Power BI embedded to display reports to external users via an application. I’ve used the progression of A sku’s (embedded license via Azure) to support the various reports. I love using the A sku for various reasons, it has a low point of entry offered in the A1. It is easy to scale up to the higher tiers as I need to. It has the ability to pause a capacity at any time. I also enjoy the flexibility of pay-by-the-hour the license provides. However, I just got to the point where one of our capacities is about to exceed the 10GB of RAM I get on the A3. As a result, I started to compare the A4 sku to the P1 sku. They are the same in terms of cores and RAM (8/25), but the P1 has an option to be cheaper.
After researching how to buy and apply the Premium P license I realized there wasn’t an end to end explanation of what to expect and how to apply the P sku to my specific region. This is hugely important in order for some of the Service features to work correctly. When committing to large sums of money, I find its always nice to have these answers up front, so I hope the following walk through helps those decision makers out there.
Analyze the A sku
Before we jump into the P sku, lets take a quick moment to see how an A sku is purchased in Azure. There is documentation out there that explains how to sign up for Premium and includes the A sku in Azure. That can be found here ( https://docs.microsoft.com/en-us/power-bi/admin/service-admin-premium-purchase). However, I want to highlight the two areas that most interest me, that I couldn’t find answers too when trying to commit to buying the P sku. There are two key areas that I care about the most with this purchase. The first, is the location of the capacity (region). Second is who gets assigned as a capacity administrator. When you purchase the A sku, those are front and center. As a result, the license purchase is an easy process because I select them prior to committing any money.
Purchase the P sku
Unlike the A sku, you purchase the P sku in the Office 365 admin center. The glaring difference from the experience with the A sku is that you purchase the P1 license without any configuration… This can cause a bit of heartburn if you need to ensure that the capacity is applied to the right region upon purchase. For the moment, you can just assume things will come out smelling like roses and move on to the steps to purchase the P1 license. In the O365 Admin Center under Billing you will Select Purchase Services and then Search for Power BI. This pulls up the list of licenses you can choose from and you are going to Select the Power BI Premium P license.
Selecting the license presents you with the options for payment type.
Here is where we see the much cheaper price of $4,995.00, but it comes with the yearly commitment. (As a side note, I really wish we had the yearly commitment option with the A sku, with that option available, I wouldn’t even have to muck around with the P sku for my implementation.)
After you complete the purchase process you can navigate to Purchase Services again and see that the Power BI Premium P license is now active.
Assign and Configure on Setup
Now what?
Well, all you saavy Power BI Admins, we head over to the Power BI Service of course!
Log in to your Service (app.powerbi.com) and because you’re all Global Administrators or Power BI Administrators you have access to the Admin Portal. For you first timers, that would be under
Settings > Admin Portal
(If you do not see the admin portal you will need to contact your IT or Security guys to grant you the Power BI Administrator Role.)
Now normally when you go into the portal you would see a page that looks like this under Capacity settings.
But after you purchase the license, in O365, and come back to the Power BI Service you will see this the first time you log in.
Click on the Set up new capacity button and you get to the screen that myself and all of you wanted to see from the start. Where you add any additional capacity administrators as well as which region you want to use for your capacity.
As the gray box outlines for you, the initial region is the home region of the Power BI tenant, but Clicking on the Region pops up all the other regions you can choose from.
Make your selections. All that remains to be done is Clicking on the Set up button. Now your capacity is provisioned based on your configuration settings.
Your new view when you log in to work with your capacity looks like this. You’ll be back often to monitor and alter any capacity configurations.
Apply Capacity to Workspace
I’ll close this out by showing you the final step of how you apply that new capacity to your workspaces.
Jump back out into the home screen by Clicking Power BI in the upper left hand corner of the browser.
Click on Workspaces and hover over the workspace that you want to add to the capacity.
Click on the ellipses (3 dots) that appear to the far right and SelectWorkspace settings.
The Settings dialogue will appear on the right hand side and you will Click on Premium in the header. Give the application a moment and you will be able to toggle the Dedicated capacity to On
In the dialogue, Select the newly provisioned capacity and Click on Save.
You will now see a little diamond next to your workspace name.
After all that, you now have a Premium P license capacity supporting the datasets and reports in that workspace.
Wrap Up
I had too many unresolved questions during this process. I was looking for something like this blog to assure me I was headed in the right direction. Since I didn’t find it, I decided to write up my experience. I want to make sure others with those same questions can to see what it looks like to go through the process from an end to end. Hopefully this perspective helps when making the leap into Power BI Premium P1 licensing.
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:
Shared datasets are a great way to share data models across the organization. This enables users to maintain one source of the truth and increase efficiency. However, models should be built separate to reports. Meaning it can be difficult to transform an existing report into a shared dataset.
This post describes how to split a pbix file with report and model, into two separate files One for the model and one for the report. This is accomplished using a PowerShell Script. By using this technique any report can quickly be split into a data model file and live connection report file.
Note: that this script is not officially supported by Microsoft. This code is provided as is without any guarantees. The code will alter the internal files, so please keep a backup if you are unsure of anything.
Think like the Business, Act like I.T
Being a great Power BI developer can often mean more than just building visually impressive reports. Focus should be given to efficiency, reusing design and data modelling where possible. In addition, there should be “one source of the truth” – different reports should not have different methods to calculate the same KPI.
This is accomplished by the creation of Shared Datasets. Users can publish a report that contains no visuals, only a data model. Multiple reports can then be built off this model by using a live connection and use the same data model. The model contains global measures. A Global measure is written and stored in the model file. Then the Global measures are re-used by other reports via the Live Connection. This ensures all reports have the same data model, logic and refresh status.
There are many reasons you should consider this approach, which is out of scope for this article. If you are less familiar with shared datasets, I encourage you to visit the following resources:
Shared datasets are great, but what if you already have a file with a model and report in one? Currently in order to split a file this would need to be manual, by either copying all the visuals over to a new report (you would also need to re-record any bookmarks, filters, layouts etc. ) or to copy all the Power Query queries (you would then need to set up relationships and re write all measures). This can be time consuming, especially on a large report or model.
Luckily for you, this code will do all the hard work for you. Simply run the code and select a PBIX file. It will create two new files, a report and a model.
Running the code
Right click and select the option Run with PowerShell in the menu.
A menu will open up. Select the power bi file that you wish to split.
Click the button OPEN to allow the script to modify your file.
The script will then create two copies of the file and add the suffix _model and _report. Feel free to rename these, if you desire.
Publishing to the Service
Model File
Open the _model file. It’s a good idea to add some text to the report explaining this is only a model file, so others understand the purpose. Example:
Publish this file to the desired workspace.
Report File
Open the _report file. The script will leave all visualizations and report features intact, but all connections will be removed. When you open the report in power bi desktop, all visuals will appear broken:
If prompted, make sure you discard changes – this will completely detach the report from the source.
Click Get Data and Select Power BI Datasets.
In the pop up window, select the model report you published in the previous step. This will now restore all visuals to display again.
Publish the report to the desired location.
That’s it! you can now share your new model file and continue to build reports off it.
Download the PowerShell file and save it to your local machine.
Script
#This script was designed by Steve Campbell and provided by PowerBI.tips
#BE WARNED this will alter Power BI files so please make sure you know what you are doing, and always back up your files!
#This is not supported by Microsoft and changes to future file structures could cause this code to break
#--------------- Released 6/2/2020 ---------------
#--- By Steve Campbell provided by PowerBI.tips ---
#Choose pbix funtion
Function Get-FileName($initialDirectory)
{
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.initialDirectory = $initialDirectory
$OpenFileDialog.filter = "PBIX (*.pbix)| *.pbix"
$OpenFileDialog.ShowDialog() | Out-Null
$OpenFileDialog.filename
}
#Error check function
function IsFileLocked([string]$filePath){
Rename-Item $filePath $filePath -ErrorVariable errs -ErrorAction SilentlyContinue
return ($errs.Count -ne 0)
}
#Function to Modify files
Function Modify-PBIX([string]$inputpath, [string[]]$filestoremove){
#Make temp folder
$temppth = $env:TEMP + "\PBI TEMP"
If(!(test-path $temppth))
{New-Item -ItemType Directory -Force -Path $temppth}
#Unpackage pbix
$zipfile = ($inputpath).Substring(0,($inputpath).Length-4) + "zip"
Rename-Item -Path $inputpath -NewName $zipfile
#Initialise object
$ShellApp = New-Object -COM 'Shell.Application'
$InputZipFile = $ShellApp.NameSpace( $zipfile )
#Move files to temp
foreach ($fn in $filestoremove){
$InputZipFile.Items() | ? { ($_.Name -eq $fn) } | % {
$ShellApp.NameSpace($temppth).MoveHere($_) }
}
#Delete temp
Remove-Item ($temppth) -Recurse
#Repackage
Rename-Item -Path $zipfile -NewName $inputpath
}
#Choose file
try {$pathn = Get-FileName}
catch { "Incompatible File" }
#Check for errors
If([string]::IsNullOrEmpty($pathn )){
exit }
elseif ( IsFileLocked($pathn) ){
exit }
#Run Script
else{
#set variables
$modelfiles = @( 'SecurityBindings', 'Report')
$reportfiles = @('Connections','DataModel', 'SecurityBindings')
#Copy files
$pathf = Get-ChildItem $pathn
$reportname = [io.path]::GetFileNameWithoutExtension($pathn)
$model = ($pathf).toString().Replace('.pbix', '_model.pbix')
$report = ($pathf).toString().Replace('.pbix', '_report.pbix')
Copy-Item $pathn -Destination $model
Copy-Item $pathn -Destination $report
#modify files
Modify-PBIX $model $modelfiles
Modify-PBIX $report $reportfiles
}
Script Usage License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
If you like the content from PowerBI.Tips please follow us on all the social outlets. Stay up to date on all the latest features and free tutorials. Subscribe to our YouTube Channel. Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.
Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:
Understand more about your model then you thought possible! This is part two in our series on DAX Studio. If you missed part one be sure to check out the Introduction to DAX Studio. In this session Marco Russo shares the fundamentals for model performance in DAX Studio and dives into key areas that you absolutely need to understand. Marco is an accomplished trainer and you won’t find a better resource to guide you on this journey.
Using DAX Studio in conjunction with Vertipaq Analyzer Marco shows us how we can discover and explore the key statistics about our models. Use Vertipaq Analyzer against your open Power BI model or any tabular model. This tool only exports the tabular metadata, not the data! So we can do offline analysis on a model we don’t have access to by having people with permissions export these metrics. Better yet, we can download this into Excel and everything gets broken down for you all the way to your relationships and measures… AMAZING!
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:
Let’s say you have a Power BI file connected to an Analysis Services machine. Then you want to change the data source to PowerBI.com using a Live Connection. Well, you are out of luck. Until NOW!!
This post describes how to remove a connection from a report using a PowerShell Script. This means any source you can just delete the data source and then re-point your report.
Note: that this script is not officially supported by Microsoft. This code is provided as is without any guarantees. The code will alter the internal files, so please keep a backup if you are unsure of anything.
Use Cases
Image the following diagram. Here we have a Power BI Report Connected to an analysis services model. Now, you wish to re-point the model to a Power BI dataset.
Note: we assume the analysis services model and the Power BI dataset model have the same definition. Meaning all the columns and measures are the same.
The below script removes connections Power BI Report.
Note: Running it on a file without a live connection will not have an effect on the file.
Running the code
Download the PowerShell file and save it to your local machine.
Right click and select the option Run with PowerShell in the menu.
A menu will open up. Select the power bi file that you wish to remove the connection from.
Click the button OPEN to allow the script to modify your file.
The script will leave all visualizations and report features intact. But, all connections will be removed. When you open the report again in power bi desktop, all visuals will appear broken:
This is because you have removed all data from the report. Select a new data source to connect the report to. If the new source matches the names of the columns and measures used in the visuals, they will all repopulate.
How the Code Works
Internally, PBIX files contain a selection of metadata and media files. The files are zipped and packaged into a pbix file.
The PowerShell script will alter these internal files, removing the Connections file which holds the information to the live connection.
It then removes a security file, SecurityBindings, that is necessary to remove in order to not corrupt the file. SecurityBindings will be repopulated the next time you edit and save the file.
Script
#This script was designed by Steve Campbell and provided by PowerBI.tips
#BE WARNED this will alter Power BI files so please make sure you know what you are doing, and always back up your files!
#This is not supported by Microsoft and changes to future file structures could cause this code to break
#--------------- Released 5/28/2020 ---------------
#--- By Steve Campbell provided by PowerBI.tips ---
#Choose pbix funtion
Function Get-FileName($initialDirectory)
{
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.initialDirectory = $initialDirectory
$OpenFileDialog.filter = "PBIX (*.pbix)| *.pbix"
$OpenFileDialog.ShowDialog() | Out-Null
$OpenFileDialog.filename
}
#Error check function
function IsFileLocked([string]$filePath){
Rename-Item $filePath $filePath -ErrorVariable errs -ErrorAction SilentlyContinue
return ($errs.Count -ne 0)
}
#Choose file
try {$pathn = Get-FileName}
catch { "Incompatible File" }
#Check for errors
If([string]::IsNullOrEmpty($pathn )){
exit }
elseif ( IsFileLocked($pathn) ){
exit }
#Run Script
else{
#Unzip pbix
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression')
$zipfile = $pathn.Substring(0,$pathn.Length-4) + "zip"
Rename-Item -Path $pathn -NewName $zipfile
#Delete files
$files = 'Connections', 'SecurityBindings'
$stream = New-Object IO.FileStream($zipfile, [IO.FileMode]::Open)
$mode = [IO.Compression.ZipArchiveMode]::Update
$zip = New-Object IO.Compression.ZipArchive($stream, $mode)
($zip.Entries | ? { $files -contains $_.Name }) | % { $_.Delete() }
#Close zip
$zip.Dispose()
$stream.Close()
$stream.Dispose()
#Repackage and open
Rename-Item -Path $zipfile -NewName $pathn
Invoke-Item $pathn
}
Editing the Code
The code runs on PowerShell. PowerShell is a cross-platform task automation and configuration management framework, consisting of a command-line shell and scripting language.
If you want to view or edit the code, first open PowerShell ISE. We recommended to run as administrator. Afterwards, you can paste the code below into the editor.
Other Considerations
The script can be useful when using two power bi files for development and deployment to the PowerBI.com service. In this use case you will have one Power BI that is the bifurcated model and one report that has just report pages. To speed up development you can Open both the Model file and the Report file. The Report file can point to a LocalHost version of the running Analysis Services.
Here is an example of what this architecture would look like.
Script Usage License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
If you like the content from PowerBI.Tips please follow us on all the social outlets. Stay up to date on all the latest features and free tutorials. Subscribe to our YouTube Channel. Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.
Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products:
If you’ve played around with MapBox in Power BI – you’ll know that it has loads of great features to create really rich and beautiful maps, including some great ‘out of the box’ map styles (i.e. base maps). However, you might not be aware that it also gives you the ability to design custom Mapbox styles with your own spatial layers. I discovered this feature on a recent project where my client wanted to include Victoria’s Catchment Management Authority (or CMA) boundaries on their base-map to provide greater context to help interpret their data. Up until this point, the only option I knew of was to purchase an expensive ArcGIS Online licence to create custom map styles. So, you can imagine just how excited I was when I discovered that I could also do this in MapBox – for FREE!!!
Reasons to Design Your Own Style
There
are plenty of reasons to design your own map styles, including:
Provide Context: I touched on this above, but the ability to add your own layers to the backgrounds on your maps goes a long way to providing additional context to help your report users understand and interpret their data.
Simplify: Sometimes you need to peel back the complexity to help your data stand out. Customizing base maps allows you to remove unnecessary elements which may distract your users from the data, and dynamically add back complexity at different zoom intervals (watch Step 4 of the Video to see how this works!)
Consistency, Branding, and Themes: Customizing the style allows you to design your maps with a similar ‘look and feel’ to other visuals in your report, as well as corporate branding and color themes. For the passionate Power BI designers out there – you’ll LOVE this feature (we’re always on the hunt for new formatting options in Power BI!)
I’m
not going to lie, there are a couple of steps involved in designing your own
custom styles for MapBox in Power BI, but believe me – it’s totally worth it! I
walk through the key steps in this short video, which include:
Create a MapBox map in
Power BI (check out the video on MapBox 101 if you’re new to MapBox, or need a
refresher).
Upload your custom tilesets
into MapBox Studio
Duplicate an existing
MapBox style from gallery
Customise your own map
style
Add your custom style into
your MapBox visual in Power BI!
First, you can leverage the base choropleth map you created in the Mapbox 101 tutorial to get a starting point. The following steps describe how to enhance the style of the map to make it pop even more!
In this tutorial we want to add a boundry onto the base map. This will help us outline the specific areas around the rivers that we added as a layer in our Drill Down tutorial. A shape file was created and the zip loaded into Mapbox as a new tileset.
The next step is to duplicate an existing map style. 1) Select New style 2) Choose a template 3) Click Customize Basic
Rename your Mapbox style (upper left side of page)
Create your own custom layers and features to the map. Here are the changes made to this example.
Click Add new layer
Search for tileset. (Our example uses the new boundry layer we created.) 1) Search for the tileset (ex. “CMA”) 2) Select tileset This will add the tileset to the base style we selected. 3) Click Type 4) Select Line to change the setting
Select Style
Choose Color
Adjust width by clicking on the Width field
Style the color based on a zoom range. Select Style across zoom range to adjust the slider.
Add new Zoom Range by Clicking on the Zoom Range bar
Select second zoom range field (Zoom 22)
Adjust zoom range to different value (10)
Change the color (Blue)
Scroll down and Click Done
Great! Now as you zoom in and out of the map you can see the boundaries change color from pink to a blue. You can imagine how powerful this visual change can be in directing the attention in different map visuals.
The final step is to take our new style and apply it to the Mapbox visual!
Select the ellipses of our style
Copy the Style URL
Jump back into the Power BI Desktop. Under Viz Setting and the Map Style Property, Select Custom.
Paste the copied URL from step 2 into the Style URL
Final Custom Mapbox Style
The case study I present is a Power BI report with three maps to help design our future cities to account for population growth, while also considering our environmental and social values (created using ‘synthetic’ datasets for demonstration purposes only). I modify the default ‘Outdoor’ MapBox style to include my own custom tileset, and show how to create dynamic color gradients based on different zoom intervals.
If you’re keen to learn how to create really cool customized maps for your Power BI reports, then make sure to check out the other blogs in this 4-part MapBox series, where we provide an introductory MapBox 101, explore how to create 3D maps, and how to design drill down maps!
And
if you want to learn how you can create really beautiful and engaging Power BI
reports, get in touch with one of the DiscoverEI team to register for our
brand-new online training courses:
If you like the content from PowerBI.Tips please follow us on all the social outlets. Stay up to date on all the latest features and free tutorials. Subscribe to our YouTube Channel. Or follow us on the social channels, Twitter and LinkedIn where we will post all the announcements for new tutorials and content.
Introducing our PowerBI.tips SWAG store. Check out all the fun PowerBI.tips clothing and products: