Forum Discussion

gmanvel's avatar
gmanvel
New Member
2 years ago
Solved

PDF export ignores passed filter

We have a PowerBI embedded in our web app. We use C# SDK to export report to a PDF file. Export uses filters applied to the report embedded in the web app to request PDF download.

 

Those filters were working just fine until all of a sudden they are completely ignored. So exported PDF report shows report for all data ignoring passed filters. If I apply those filters visually in powerbi portal, data is properly filtered & shown on the report.

 

Rougly this is the code being used

 

 

 

var powerBiReportConfig = new PowerBIReportExportConfiguration()
{
	ReportLevelFilters = reportLevelFilters,
	Identities = new List<EffectiveIdentity> { effectiveIdentity },
	Settings = new ExportReportSettings { IncludeHiddenPages = false }
};
var requestParams = new ExportReportRequest
{
	Format = FileFormat.PDF,
	PowerBIReportConfiguration = powerBiReportConfig,
};

var export = await powerBiClient.Reports.ExportToFileAsync(groupId, reportId, requestParams);

 

 

Filter that is applied to the report in embedded mode is

 

 

 

{
	"ReportLevelFilters": [
		{
			"$schema": "http://powerbi.com/product/schema#basic",
			"target": {
				"table": "MyTable",
				"column": "UniqueNumber"
			},
			"filterType": 1,
			"operator": "In",
			"values": [
				"7627043-7627043"
			]
		},
		{
			"$schema": "http://powerbi.com/product/schema#basic",
			"target": {
				"table": "MyTable2",
				"column": "UniqueNumber"
			},
			"filterType": 1,
			"operator": "In",
			"values": [
				"7627043-7627043"
			]
		},
		{
			"$schema": "http://powerbi.com/product/schema#basic",
			"target": {
				"table": "MyTable",
				"column": "CreationDate"
			},
			"filterType": 1,
			"operator": "In",
			"values": [
				"2024-06-21T00:00:00"
			]
		},
		{
			"$schema": "http://powerbi.com/product/schema#basic",
			"target": {
				"table": "MyTable",
				"column": "CreationDate"
			},
			"filterType": 1,
			"operator": "In",
			"values": [
				"2024-06-21T00:00:00"
			]
		}
	]
}

 

 

 

which is getting translated to this to be sent via SDK

 

 

var reportLevelFilters = new List<ExportFilter> {
new ExportFilter { Filter =
"MyTable/UniqueNumber in ('7627043-7627043') and MyTable2/UniqueNumber in ('7627043-7627043') and MyTable/CreationDate in ('2024-06-21T00:00:00') and MyTable/CreationDate in ('2024-06-21T00:00:00')" }};

 

 

 

What could have caused this ignoring the filters ? Can you suggest what to check ?

 

 

1 Reply