This would be useful for companies that are using PBIRS (On Premises Power bi reporting services). The world is migrating to the cloud but there is no shame if your company for a reason or two are still debating to migrate to the cloud.  This article is tailored to overcome the export feature in the visual that has a limitation to export less than 150k rows to an excel workbook or 30k rows to a csv.


Keep in mind that and even that’s what the warning says it all depends on how many columns you are trying to export you might end up truncating your data by exporting less rows than the limitations. With all that said Power Bi is not meant for exporting data, it is a visualization tool and it is optimized for data aggregation after all.  Let’s say you create a beautiful dashboard and your users are super happy then the usual happens, you get a call from a user asking if he or she can have access to detail data. Of course you and I care about the user satisfaction and you go ahead and you design the most beautiful Detailed page and you implement the lovely drill-throughs only to find out that a user is trying to export over 150k rows to excel because Power bi screamed the warning at him or her. What do you do in this case? You are the man, Your brilliant solution is to create an ssrs report for the user and schedule subscription? That is great but it is not interactive, After all you already impressed the user by the interactive dashboard and now she or he is interested only in data she sees and filtered in the detail page through drill-through and slicer. We are going to fill in the blank by passing the Slicers values to the Parameters in your beautiful SSRS Paginated report and have export automatically using export buttons:

The fun part you have been waiting for Coding time

Let’s get started,
You have your SSRS report with Parameters similar the slicers in your detail page ready. In this example we have 3 slicers in the detail pages and 3 parameters in the SSRS report: Date Parameter that return all data before (As of date), Violation Category, a Multi-value Parameter with spaces in the values. For the Icons you can use images, buttons or shapes your choice. In this tutorial we will images. You could get such icons from Flaticon website. The idea here is after the user makes selections in the slicers they can click PDF, Excel or CSV to export the data to a format of their choice.

Creating DAX Measures to do the magic.

We will create 3 measure, each will export the data using URL magic.

[Export to PDF] :=
VAR CatPar =
    SELECTEDVALUE ( ViolationCategory[Violation Category] )
VAR Selecteddate =
    MAX ( ‘Date'[Date] )
VAR SelectedCategory =
    DISTINCT ( ‘ViolationCategory'[Violation Category] )
VAR Delim2 = “&ViolationCategory=”
VAR ConcatSelectedCat =
    CONCATENATEX ( SelectedCategory, ViolationCategory[Violation Category], Delim2 )
VAR SelectedCatFinal =
    SUBSTITUTE ( ConcatSelectedCat” ““%20” )
VAR URLL = “http://jmac/ReportServer/Pages/ReportViewer.aspx?%2fDemo-DynamicUrl%2fDemo_DynamicUrl &RullingDate=” & Selecteddate & “&ViolationCategory=” & SelectedCatFinal & “&rs:Format=pdf&rs:clearsession=true”
RETURN
    URLL

Now, lets breakdown the measure code to get a full understanding.

Let’ start with the date because we are using Before Date Slicer we caputure the selected date in the variable Selecteddate  by using the Max(Date[Date]).
 Now lets deal with The Violation Category Slicer as it is more complicated to pass as it is a MultiValue parameter in SSRS, but do not worry I will explain it very well. Because it is Multivalue parameter we will need concatenate the selected values dynamically and embed them in the URL. We will need the fancy CONCATONATEX DAX function to help us achieve our goal. We have challenge: We do not have IDs for Violation Category we are obligated to pass the Violation Category as with spaces between the words. We can overcome this challenge by replacing the spaces with %20. Now we can construct our url.  
&rs:Format=pdf : This part of the code is what tells SSRS to use the PDF format to export. This part can be changed to CSV or Excel.
One last thing we add rs:clearsession=true to clear user session/ Cache to avoid any reports executions errors for the user .

Before we dive in the last step make sure you format your measures as Text in the Format pane in the Ribbon

Export to Excel Measure:

EXCEL_Export =
VAR CatPar =
    SELECTEDVALUE ( ViolationCategory[Violation Category] )
VAR Selecteddate =
    MAX ( ‘Date'[Date] )
VAR _Search =
    BLANK ()
VAR SelectedCategory =
    DISTINCT ( ‘ViolationCategory'[Violation Category] )
VAR Delim2 = “&ViolationCategory=”
VAR ConcatSelectedCat =
    CONCATENATEX ( SelectedCategory, ViolationCategory[Violation Category], Delim2 )
VAR SelectedCatFinal =
    SUBSTITUTE ( ConcatSelectedCat” ““%20” )
VAR URLL = “http://jmac/ReportServer/Pages/ReportViewer.aspx?%2fDemo-DynamicUrl%2fDemo_DynamicUrl &RullingDate=” & Selecteddate & “&ViolationCategory=” & SelectedCatFinal & “&SEARCH=” & _Search & “&rs:Format=excel&rs:ClearSession=true”
RETURN
    URLL

Export to CSV Measure:

[CSV Export] =
VAR CatPar =
    SELECTEDVALUE ( ViolationCategory[Violation Category] )
VAR Selecteddate =
    MAX ( ‘Date'[Date] )
VAR _Search =
    BLANK ()
VAR SelectedCategory =
    DISTINCT ( ‘ViolationCategory'[Violation Category] )
VAR Delim2 = “&ViolationCategory=”
VAR ConcatSelectedCat =
    CONCATENATEX ( SelectedCategory, ViolationCategory[Violation Category], Delim2 )
VAR SelectedCatFinal =
    SUBSTITUTE ( ConcatSelectedCat” ““%20” )
VAR URLL = “http://jmac/ReportServer/Pages/ReportViewer.aspx?%2fDemo-DynamicUrl%2fDemo_DynamicUrl &RullingDate=” & Selecteddate & “&ViolationCategory=” & SelectedCatFinal & “&SEARCH=” & _Search & “&rs:Format=csv&rs:ClearSession=true”
RETURN
    URLL

Magic In Power bi to wrap the solution

Click on the image of the format you want to export to then choose Action the Format Image Pane then from the Type drop down choose Web URL then fx.

After click the fx you will be greeted with a popup windows choose Field Value and Based on Field choose the measure in this Case I choose PDF Export Measure.

The Conclusion:

Good news! you are done, now you can test, make selections in the slicer and export as much rows as SSRS can handle and overcome the Power BI data export limitation. This method would work on the new paginated report in power bi service as well with some modifications to the base URL.