{"id":15677,"date":"2021-07-16T13:45:00","date_gmt":"2021-07-16T20:45:00","guid":{"rendered":"https:\/\/devwww.3cloudsolutions.com\/post\/create-paginated-reports-for-everyone-using-separate-exports-3\/"},"modified":"2023-07-28T13:59:57","modified_gmt":"2023-07-28T20:59:57","slug":"create-paginated-reports-for-everyone-using-separate-exports","status":"publish","type":"post","link":"https:\/\/3cloudsolutions.com\/resources\/create-paginated-reports-for-everyone-using-separate-exports\/","title":{"rendered":"Create Paginated Reports for Everyone Using Separate Exports"},"content":{"rendered":"<p>How many times have you struggled to find the happy medium between a report that looks phenomenal when printed, but has everything a user might need in an Excel export? I recently built a beautiful paginated report with groupings separated by white space <a href=\"\/blog\/better-together-blog-series-principles-of-data-visualization\" target=\"_blank\" rel=\"noopener\"><span style=\"color: #007cba;\">for easy readability<\/span><\/a> \u2013 but the user wanted to export the results to Excel, and the format prevented them from sorting or filtering the report contents. <a href=\"https:\/\/docs.microsoft.com\/en-us\/power-bi\/paginated-reports\/report-builder-power-bi\" target=\"_blank\" rel=\"noopener\"><span style=\"color: #007cba;\">Power BI Report Builder<\/span><\/a> has a couple features that can allow you the best of both worlds, with a few simple tricks. By the end of this tutorial, you will have created two <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/reporting-services\/report-design\/tablix-data-region-cells-rows-and-columns-report-builder-and-ssrs?view=sql-server-ver15\" target=\"_blank\" rel=\"noopener\"><span style=\"color: #007cba;\">Tablix<\/span><\/a>, set up conditional visibility based on report render format, and set conditional sizing on the Excel Tablix (using hidden charts!) to prevent blank pages.<\/p>\n<p><!--more--><\/p>\n<p><span style=\"color: #007cba;\"><img decoding=\"async\" style=\"width: 748px;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/iStock-1202255735-1.jpg\" alt=\"iStock-1202255735-1\" width=\"748\" \/><br \/>\n<\/span><\/p>\n<h2><span style=\"color: #007cba;\">Part 1: Set up two Tablix<\/span><\/h2>\n<p>Your first Tablix will be the page view or PDF view. Your second Tablix will be the Excel export.<\/p>\n<p>With the first table, I have three rows tied to the header grouping, one row for my details, and a final row for totals. The first row is for Region, which is my highest grouping. The second row is white space, because I want a visual separation between the States; the third row is my State grouping and headers combined. In the design view, this is what that looks like:<\/p>\n<h2><img decoding=\"async\" style=\"width: 500px; margin-left: auto; margin-right: auto; display: block;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-04-47-58-PM.png\" width=\"500\" \/><\/h2>\n<p>When I\u2019m done, this is what the report page view looks like:<\/p>\n<p><img decoding=\"async\" style=\"width: 500px; margin-left: auto; margin-right: auto; display: block;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-06-19-53-PM-1.png\" alt=\"image-png-Jul-08-2021-01-06-19-53-PM-1\" width=\"500\" \/><\/p>\n<p>Looks great! But when I export the report, although it still looks pretty good, my report users really can\u2019t sort or filter on the data. Region and State are in the same column, and my data headers are repeated for every state.<\/p>\n<p><img decoding=\"async\" style=\"width: 500px; margin-left: auto; margin-right: auto; display: block;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-08-27-59-PM.png\" width=\"500\" \/><\/p>\n<p>This is why I need a second version just for Excel. As such, my second Tablix is a very simple table with no groupings \u2013 the groups I have in the page view table are now just regular fields in the second table. My users also wanted a lot of <a href=\"\/blog\/the-ultimate-list-of-ai-features-in-power-bi\" target=\"_blank\" rel=\"noopener\"><span style=\"color: #007cba;\">additional data for drilling down<\/span><\/a>, so this Tablix has several extra columns that are not present in the PDF\/page view Tablix. I <em>love<\/em> this trick, because it\u2019s a common situation \u2013 you want a version of a report you can print, but the users want so many extra columns, it won\u2019t fit on one page! Usually, you end up smushing content or making the font <em>really,<\/em><span style=\"font-size: 14px;\"><em> really <\/em><\/span><span style=\"font-size: 10px;\">small, <\/span>or your report is\u00a0 e x t r a\u00a0\u00a0 w i d e\u00a0 and can\u2019t be printed. This same concept can be used in that situation to have conditionally visible columns!<\/p>\n<p><img decoding=\"async\" style=\"margin-left: auto; margin-right: auto; display: block;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-10-56-05-PM.png\" \/><\/p>\n<p>This is what the second table looks like: no frills, just data. Notice the new columns, Product, Wholesale Price, Order Count, and Discount Amount. I didn\u2019t have room for that in my page view table originally, but my target audience <a href=\"\/blog\/better-together-blog-series-principles-of-data-visualization\" target=\"_blank\" rel=\"noopener\"><span style=\"color: #007cba;\">won\u2019t always need those details<\/span><\/a>, so they agreed that having them in the export would be sufficient.<\/p>\n<p>Now that we have our two tables, we need to set when each is visible.<\/p>\n<h2><span style=\"color: #007cba;\">Part 2: Set Up Conditional Visibility<\/span><\/h2>\n<p>Power BI Report Builder has two features that are going to allow us to show or hide the tables based on how the report is being rendered to the user. First, it has <span style=\"color: #007cba;\"><a style=\"color: #007cba;\" href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/reporting-services\/report-builder\/hide-an-item-report-builder-and-ssrs?view=sql-server-ver15\" target=\"_blank\" rel=\"noopener\">expression-based visibility<\/a><\/span>. On the Properties Pane, with your page view Tablix selected, you should see a visibility property almost at the very bottom.<\/p>\n<p style=\"vertical-align: bottom;\"><span style=\"color: black;\"><img decoding=\"async\" style=\"width: 250px;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-12-54-69-PM.png\" width=\"250\" \/><img decoding=\"async\" style=\"width: 250px;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-13-17-54-PM.png\" width=\"250\" \/><\/span><\/p>\n<p>Choose Expression from the dropdown, and we will craft our expression based on when we want the tablix to be hidden. In this case, we want it to be hidden when we are exporting to Excel, which brings us to the second functionality Report Builder has \u2013 a built-in field that will populate with the report render format called <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/reporting-services\/report-design\/built-in-collections-built-in-globals-and-users-references-report-builder?view=sql-server-ver15\" target=\"_blank\" rel=\"noopener\"><span style=\"color: #007cba;\">RenderFormat.Name<\/span><\/a>. You can find it under \u201cBuilt-in Fields\u201d in the expression builder.<\/p>\n<p><img decoding=\"async\" style=\"width: 500px; margin-left: auto; margin-right: auto; display: block;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-14-11-43-PM.png\" width=\"500\" \/><\/p>\n<p>As you can see in the above screen capture, our expression for hiding this table is as follows:<\/p>\n<p>= Globals!RenderFormat.Name = &#8220;EXCELOPENXML&#8221;<\/p>\n<p style=\"padding-left: 40px;\"><em>Note: Depending on the version you have, your RSReportServer configuration file may call these formats by a different name. If \u201cEXCELOPENXML\u201d does not work, you can try \u201cEXCEL\u201d. If that still does not work, you might need to check your config file.<\/em><\/p>\n<p>Repeat the same steps for the second table, the one we do want to show in Excel. Our expression for that will be:<\/p>\n<p>= Globals!RenderFormat.Name &lt;&gt; &#8220;EXCELOPENXML&#8221;<\/p>\n<p>In other words, if the report is rendering anywhere except Excel, this table should be hidden.<\/p>\n<p>When you test this out, if your two tables were the same width and you don\u2019t have any blank pages\u2026. congratulations! You can skip Step 3, you\u2019re done! But if you had to add columns like I did, and your design view looks something like this and every other page in the PDF is blank, stick with me\u2026we\u2019ll solve it!<\/p>\n<p><img decoding=\"async\" style=\"width: 650px; margin-left: auto; margin-right: auto; display: block;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-15-18-45-PM.png\" width=\"650\" \/><\/p>\n<h2><span style=\"color: #007cba;\">Part 3: Set Up Conditional Sizing with Charts<\/span><\/h2>\n<p>Our problem now is that even though our Excel Tablix is hidden on page view, Report Builder sees those extra 3.5 inches of white space adjacent to the page view Tablix and adds the extra page to display it. I could make each column smaller, but unfortunately then my report users will have to expand the columns <em>every<\/em> time they export to Excel and want to view the data.<\/p>\n<p>My solution to this issue is to add an extra row at the top and use an expression to expand the size when it renders in Excel; then I will shrink the columns in the design view so it\u2019s no wider than my page view table.<\/p>\n<p>Add an extra row just to your Excel view table, then click \u201cInsert\u201d and choose \u201cChart\u201d. Click inside the first cell of your blank row and choose any of the charts offered. It doesn\u2019t matter which one, I simply chose the first bar chart. It will look something like this when you are done:<\/p>\n<p><img decoding=\"async\" style=\"margin-left: auto; margin-right: auto; display: block;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-17-47-10-PM.png\" \/><\/p>\n<p>We are not adding any data to it, but placing the chart inside this cell opened up some new options on the Properties pane. These are the two we will be using, Dynamic Height and Dynamic Width.<\/p>\n<p><img decoding=\"async\" style=\"width: 300px; margin-left: auto; margin-right: auto; display: block;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-19-15-65-PM.png\" width=\"300\" \/><\/p>\n<p>First, set Dynamic Height to 0. When the report renders, this row will have a height of zero, so no one will be able to see our faux charts.<\/p>\n<p>Next, we will set the Dynamic Width to an expression that will look a little familiar, since we used something like it for conditional visibility.<\/p>\n<p><img decoding=\"async\" style=\"width: 650px; margin-left: auto; margin-right: auto; display: block;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-20-06-18-PM.png\" width=\"650\" \/><\/p>\n<p>=IIf(Globals!RenderFormat.Name=&#8221;EXCELOPENXML&#8221;,&#8221;1in&#8221;,&#8221;.5in&#8221;)<\/p>\n<p>In my case, I picked 1\u201d wide columns when exported, but you should pick a size that fits your data well. You can make each one a custom size, but before we do any fiddling, let\u2019s copy and paste our chart into all the blank cells in row 1. This also copies our dynamic sizing, so even if you want to tweak it later, this will save some typing.<\/p>\n<p>Once the first row is filled with faux charts, you can start shrinking your column widths to fit. This is what mine looks like when I\u2019m done setting them all to a half inch, which worked in my case.<\/p>\n<p><img decoding=\"async\" style=\"width: 500px; margin-left: auto; margin-right: auto; display: block;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-20-57-64-PM.png\" width=\"500\" \/><\/p>\n<p>When I run the report, the first good sign are my page counts. I\u2019m down to 9 pages instead of 36 \u2013 the Excel version Tablix is not rendering on the report anymore, and I don\u2019t have blank pages in between every page.<\/p>\n<p style=\"padding-left: 40px;\"><em>Tip: If you have a blank final page when running the report on the PBI Service, add a rectangle to your report body and drag both Tablix inside the rectangle, then put the rectangle back where your Tablix were. This keeps the second Tablix from making an extra page for itself.<\/em><\/p>\n<p style=\"padding-left: 40px;\"><em><img decoding=\"async\" style=\"width: 500px; margin-left: auto; margin-right: auto; display: block;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-22-18-77-PM.png\" width=\"500\" \/><\/em><\/p>\n<p>And this is the result of my Excel export:<\/p>\n<p><img decoding=\"async\" style=\"width: 500px; margin-left: auto; margin-right: auto; display: block;\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2022\/11\/image-png-Jul-08-2021-01-23-14-97-PM.png\" width=\"500\" \/><\/p>\n<h2><\/h2>\n<h2><span style=\"color: #007cba;\">Conclusion<\/span><\/h2>\n<p>Now my users have an export that can be sorted and filtered with minimal effort, and which contains columns with additional details they didn\u2019t need in the main report but might be interested in digging into in the export. This is quick to set up once you know how, and I think it\u2019s a nice way to have it <em>both<\/em> ways \u2013 beautiful, executive-ready PDF and detailed, explorable Excel for those users who want to have it all. <a href=\"https:\/\/www.bluegranite.com\/\">BlueGranite<\/a> has strong experience deploying a mix of both <a href=\"https:\/\/www.bluegranite.com\/modern-bi\">Power BI<\/a> and paginated reporting in organizations of all sizes. If you&#8217;re wondering how paginated reports could better fit into your Power BI deployment, <a href=\"https:\/\/www.bluegranite.com\/contact-us\">contact us<\/a> today!<\/p>\n<p>BlueGranite offers a variety of <a href=\"https:\/\/www.bluegranite.com\/resources\" target=\"_blank\" rel=\"noopener\">resources<\/a> to help you learn how you can leverage Modern Data Analytics. We also offer <a href=\"https:\/\/www.bluegranite.com\/events\" target=\"_blank\" rel=\"noopener\">free training events<\/a> such as:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.bluegranite.com\/power-bi-dashboard-in-a-day\" target=\"_blank\" rel=\"noopener\">Power BI Dashboard in a Day<\/a><\/li>\n<li><a href=\"https:\/\/www.bluegranite.com\/ai-in-a-day-with-power-bi\" target=\"_blank\" rel=\"noopener\">AI in a Day with Power BI<\/a><\/li>\n<li><a href=\"https:\/\/www.bluegranite.com\/webinar-intro-to-dax\" target=\"_blank\" rel=\"noopener\">Intro to DAX<\/a><\/li>\n<\/ul>\n<p>Please visit our <a href=\"https:\/\/www.bluegranite.com\/events\" target=\"_blank\" rel=\"noopener\">website<\/a> to learn more, or <a href=\"https:\/\/www.bluegranite.com\/contact-us\" target=\"_blank\" rel=\"noopener\">contact us<\/a> directly to see how we can help you explore your about modern data analytics options and accelerate your business value.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How many times have you struggled to find the happy medium between a report that looks phenomenal when printed, but has everything a user might need in an Excel export? Stop compromising and start creating Paginated Reports with separate PDF and Excel exports.<\/p>\n","protected":false},"author":21,"featured_media":12572,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[260],"tags":[273],"class_list":["post-15677","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-ai","tag-power-bi","topics-blog"],"acf":[],"_links":{"self":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts\/15677","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/comments?post=15677"}],"version-history":[{"count":0,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts\/15677\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/media\/12572"}],"wp:attachment":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/media?parent=15677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/categories?post=15677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/tags?post=15677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}