Вы находитесь на странице: 1из 19

SQL with Dustin Ryan

POWER BI

Another 5 Power BI Tips

JANUARY 30, 2017 | DUSTIN RYAN | 1 COMMENT


If youve been at least paying attention to my blog a little bit, youve probably noticed I occasionally blog
about Power BI (https://sqldusty.com/category/powerbi/). Part of the reason I blog so often about Power
BI is because thats the topic of a whole bunch of conversations Im having with my customers. The other
reason is that the customer Im speaking with have lots of questions about Power BI. So consider this one
of my efforts at scaling myself.

View and download my latest Power BI architecture diagram here!


(https://sqldusty.com/2016/06/18/power-bi-architecture-diagram-v2-
is-now-available/)
If you enjoy this Power BI tips and tricks type posts, check out my first five Power BI tips (https://sql
dusty.com/2015/08/28/5tipsforpowerbi/) and then my second five Power BI tips (https://sql
dusty.com/2016/06/29/5morepowerbitips/). Youll probably enjoy those if you found this post helpful.
So without further ado, I present to you more Power BI tips that I truly hope youll find helpful.

1. Use a Dashboard as a Navigation Pane for Your BI and


Reporting Content

One of the great things about Power BI Dashboards is that you can customize the link or links a tile can
use. For instance, in the dashboard below youll notice that I have a tile titled Dashboard Index. This
tile is being used to link to specific pages within a single report.

(https://sql

dusty.files.wordpress.com/2017/01/image.png)

Adding a custom tile is easy. First navigate to the dashboard you want to customize. Next, click the +
Add Tile button in the top right of the Dashboard.
(https://sql

dusty.files.wordpress.com/2017/01/image1.png)

Then click the type of custom tile youd like to add. If you want to add a Dashboard index to facilitate
navigation through your Power BI content like I did, select Text Box on the right. Click Next.

(https://sqldusty.files.wordpress.com/2017/01/im

age2.png)

Enter your Title and Subtitle if you need to. Key in your text, highlight the text youd like to use for your
hyperlink, and then click the insert link button. Then just enter your link into the text box that will ap
pear. Click Apply when youre done.
(https://sql

dusty.files.wordpress.com/2017/01/image3.png)

Alternatively, you can also cause an entire tile to link to a single location. Just click the check box next to
Set custom link, provide a URL, and the entire tile will link to a single location.
(https://sqldusty.files.wordpress.com/2017/01/im

age4.png)

Theres a lot of different things you can do with your Power BI Dashboards to improve usability and add
value for your users. Dashboard tiles can also be used to link to videos (YouTube or Vimeo), custom im
ages, or other custom web content. Visit the documentation here to learn more (https://powerbi.mi
crosoft.com/enus/documentation/powerbiserviceaddawidgettoadashboard/) about all the cool
things you can do with Dashboard tiles.

2. Use OneDrive for Business as Source Control for your


Power BI Desktop Files

A question I hear somewhat frequently is, How do I keep source control on my Power BI Desktop files?
Sure, you could use any of the traditional source control products out there like TFS, SVN, or whatever
else. But an option that you may have overlooked and may already be in your backpocket is OneDrive
for Business. If your organization is using OneDrive for Business, you already have the functionality to
track previous versions of documents stored in OneDrive.

Versioning is enabled by default in OneDrive for Business, but if for some reason versioning is turned off,
you may be able to turn it on by using these instructions found here (https://support.office.com/enus/ar
ticle/RestoreapreviousversionofadocumentinOneDriveforBusiness159cad6dd76e498188ef
de6e96c93893?ui=enUS&rs=enUS&ad=US).
Using OneDrive, I can view previous versions of a file or even restore a previous version of a file. To
view a previous version of a file, navigate to OneDrive from your Office 365 portal and find the file in
which youre interested. Rightclick on the file and select Version History.

(https://sql

dusty.files.wordpress.com/2017/01/image5.png)

Then I will see all the previous versions of the file. In this case, the file is a .pbix file I use for customer de
mos.

If you want to simply download the previous version of the .pbix file (or any other file for that matter)
and poke around, just click the Modified date next the version youre interested in. This will download
the previous version of the file.
(https://sql

dusty.files.wordpress.com/2017/01/image6.png)

If you click the drop down arrow next to the Modified date associated with a previous version of the file,
youll expose a few options:

View: This will allow me to view the properties of the previous version of the file, which is really not
all that useful.

(https://sqldusty.files.wordpress.com/2017/01/image7.png)

Restore: This will let me make the selected version the most current version.

(https://sqldusty.files.wordpress.com/2017/01/image8.png)

Delete: This deletes a previous version of your file. Pretty selfexplanatory here.
3. Disable Load to Report Option to Eliminate Loading of
Duplicate Data and Reduce Power BI Model Size

If youre querying multiple data sets and then merging the results into a single query within Power BI,
you may be storing duplicate copies of your data and unnecessarily inflating the size of your Power BI
model. We can configure a query within Power BI, however, to not be loaded into the model, thus reduc
ing the size of the Power BI model.

For example, take this Power BI Desktop file. I have two queries that are each pulling from a .csv file. One
query has some data related to sales in France and the other query has some data for sales in Mexico. In
this example, Im merging the query results from MX Sales into FR Sales.

(https://sql

dusty.files.wordpress.com/2017/01/image9.png)

This means that the results of the query MX Sales are stored in the MX Sales table in my model and the
results of both queries, FR Sales and MX Sales, are stored in the FR Sales table which means Ive got a bit
of bloat in my model. If I check the size of my .pbix file, youll see that the file is 3,697 KB.
(https://sqldusty.files.wordpress.com/2017/01/image10.png)

If I go back to the Query Editor, I can disable Enable Load for the MX Sales query. This will prevent this
query from being loaded as a table in my model. The results of the query, however, will still be merged in
the FR Sales query.

(https://sqldusty.files.wordpress.com/2017/01/image11.png)

Once I disable Enable Load for MX Sales, youll see the query grayed out.
(https://sqldusty.files.wordpress.com/2017/01/image12.png)

After I save my Power BI Desktop file, you can now see that the size of the .pbix file is significantly small
er.

(https://sqldusty.files.wordpress.com/2017/01/image13.png)

And the revenue numbers for both countries are still included in the FR Sales table, as you can see here.

(https://sql

dusty.files.wordpress.com/2017/01/image14.png)

4. Enable Assume Referential Integrity to Improve Di-


rectQuery Performance
A feature was added to Power BI Desktop in March last year that is worth pointing out. The feature is a
setting on relationships called Assume Referential Integrity. This setting is exposed in your models
configured to use DirectQuery and it allows you to explicitly specify that your model should assume ref
erence integrity in the underlying tables.

To view the setting, go to Manage Relationships in Power BI Desktop, select a relationship, and click Edit.

(https://sql

dusty.files.wordpress.com/2017/01/image16.png)

So what does this setting do for you? Well by default, when Power BI queries two tables that have a rela
tionship, the two tables are joined using an outer join. Take for example, this chart, which leverages two
tables: FactDiscipline and DimDisciplineActionCode. These two tables share a one to many relationship.
(https://sqldusty.files.wordpress.com/2017/01/image15.png)

If I take a look at the query generated by this visualization using the magic of SQL Server Profiler, I can
clearly see that the two tables used are joined using a left outer join.
(https://sql

dusty.files.wordpress.com/2017/01/image81.png)

If I check the option to Assume Referential Integrity on the relationship between the table FactDiscipline
and DimDisciplineActionCode, like so
(https://sql

dusty.files.wordpress.com/2017/01/image17.png)

When I refresh the chart, I can see that instead of an outer join, the query uses an inner join:
(https://sql

dusty.files.wordpress.com/2017/01/image121.png)

Now depending on your data, this could provide a performance benefit generating a more efficient que
ry. Obviously, however, if you have mismatched data between the two tables or NULL values on one
side of the join, you could get an incorrect result.

Check out this link to learn more (https://powerbi.microsoft.com/enus/documentation/powerbidesktop


assumereferentialintegrity/) about some of the specifics of Assume Referential Integrity and some of the
gotchas you could run into if you set this setting incorrectly.

5. Use On-Prem Data Gateway PerfMon Counters to Moni-


tor Gateway Performance

There are a number of Performance Monitor counters that we can use to determine Data Gateway perfor
mance. These counters wont tell us how long specific queries are taking, but they will give us an indica
tion on the resources being used on the machine the Data Gateway is installed and if we should set up
another Data Gateway in order to spread the workload across multiple machines and Data Gateways.
ThesecounterscanbeusedtomeasurethingslikethenumberofDirectQueryqueriesagainstonprem
datasources,thenumberofconnectionsbeingopenedonyourSQLServerAnalysisServicesassets,or
thenumberoffailedqueriespersecond,forexample.Ifyourenoticingthatperformanceissuffering
whileusersarebrowsingmodelsinthePowerBIservicethatuseaDirectQueryconnectionwhenperfor
manceisusuallyexceptional,thenitstimetotakealookatthePerfMoncountersfortheDataGateway.

ToopenPerformanceMonitor(PerfMonforshort),doasearchinWindowsonthemachinewherethe
DataGatewayisinstalledforperfmon.SelectPerformanceMonitorontheleft.Thenrightclickwithin
thegraphareaandselectAddCounters.

(https://sql

dusty.files.wordpress.com/2017/01/image18.png)

ThenbrowsethroughthelistofavailablecountersandfindOnpremisesdatagateway.
(https://sqldusty.files.wordpress.com/2017/01/image19.png)

SelectthecountersyoureinterestedinandclickAdd.ThenclickOK.Nowyourereadytomonitoryour
datagatewayperformance!
(https://sqldusty.files.wordpress.com/2017/01/image20.png)

AsyoubegintorolloutPowerBItomoreandmoreuserswithinyourorganization,thiswillbeahandy
tooltohaveinyourbelt.Ivehadcustomerswhohaveunexpectedlyrunintoperformanceissueswith
theirPowerBIreportsbecausetheworkloadsandusagecreptuponthemwithoutthemrealizingit.The
remedywastomovetheOnpremisesDataGatewaytoanothermachinewithmoreresourcesavailable.

YoucanreadmoreaboutthePerformanceCountershere (https://powerbi.microsoft.com/enus/documen
tation/powerbigatewayonpremtshoot/#performance).

Resources

Checkoutmyfirst5PowerBItips:https://sqldusty.com/2015/08/28/5tipsforpowerbi/ (https://sql
dusty.com/2015/08/28/5tipsforpowerbi/)

Andofcourseyouneedtocheckoutthesecond5PowerBItips:https://sqldusty.com/2016/06/29/5more
powerbitips/ (https://sqldusty.com/2016/06/29/5morepowerbitips/)

ThisarticleontroubleshootingPowerBIisreallygreatandIrecommendyoutakealook:https://power
bi.microsoft.com/enus/documentation/powerbigatewayonpremtshoot/ (https://powerbi.mi
crosoft.com/enus/documentation/powerbigatewayonpremtshoot/)

AndheresthearticleonAssumeReferentialIntegrity:https://powerbi.microsoft.com/enus/documenta
tion/powerbidesktopassumereferentialintegrity/ (https://powerbi.microsoft.com/enus/documenta
tion/powerbidesktopassumereferentialintegrity/)

Feedback?

I hopeyoufoundthisuseful.Feelfreetoleaveacomment,thought,orbitoffeedbackdownbelow!
Thanksforreading!

Power BI Desktop Excel 2013 VBA -


(online) Mdulo I (online)

R$ 348,27 R$ 858,73

DATA GATEWAY POWER BI POWER BI DESKTOP

One thought on Another 5 Power BI Tips

1. Pingback:Another5PowerBITips SQLwithDustinRyan|MSExcel|PowerPivot|DAX|SSIS
|SQL

Вам также может понравиться