We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi,
I have two visuals Line chart and a bar chart in a page with columns Release month and Release date respectively.
I'm trying to filter these visuals with javascript api. Both are advanced filter schema. I'm able to apply them indiviually but not both of them together at the same time.Getting invalid filter definition error
Have verified the date formats i'm using and are correct.Cant we apply two advanced date filters at the same time.
Any help is highly appreciated.No luck on this inspite of mulitple trys and efforts.
var monthFilter = {
$schema: "http://powerbi.com/product/schema#advanced",
target: {
table: "Line Chart",
column: "ReleaseMonth"
},
logicalOperator: "AND",
conditions: [
{
operator: "GreaterThanOrEqual",
value: convertDate(selectedFromDate) + "T00:00:00.000Z"
},
{
operator: "LessThanOrEqual",
value: convertDate(selectedToDate) + "T00:00:00.000Z"
}
]
}
var dateFilter = {
$schema: "http://powerbi.com/product/schema#advanced",
target: {
table: "Query1",
column: "ReleaseDate"
},
logicalOperator: "AND",
conditions: [
{
operator: "GreaterThanOrEqual",
value: convertDate(selectedFromDate) + "T00:00:00.000Z"
},
{
operator: "LessThanOrEqual",
value: convertDate(selectedToDate) + "T00:00:00.000Z"
}
]
}
filters.push(monthFilter);
filters.push(dateFilter);
report.setFilters(filters);
Facing very similar issue.
fromdatefilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "MyData",
column: "ORDER_CREATION_DATE"
},
operator: "GreaterThan",
values: fromDateValue
};
Any specific format to be given for Date? Other integer and string filters seem to work.
I don't get the invalid filter denition and based on my test, applying two advanced filter shall work.
<html>
<script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/jquery/dist/jquery.js"></script>
<script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/powerbi-client/dist/powerbi.js""></script>
<script type="text/javascript">
var embedConfiguration = {
type: 'report',
accessToken: 'eyJ0eXAiOiJKVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX190TUxkdVNKMVQ4Y2FIeFU3Y090YyIsImtpZCI6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iMS4wIn0.vGL9W6DDkLTMLLKqI76nrh4wOBFYaEFKjy0ile7XS1X46oEtdDRBCbfhnB9FhkbTlW0_vS4JC7Uz1XyPjirKlZr31OMDU-3avGWP_ynx4pCkUw0qSiwUBsWdWsNXfgFe46jDnw225yQfgU3gSjDkN578SBA13QFRVFZthdtBmk09Yhdp79v4lUYmec3GuDY2wTn1hjpCoBr60V5Z7WPBsyDfHw_s6gKGJQCGNgK1xCJQGUo2gVVsxegrlT4J2nQoeCnMis-7sNytWCH4vIM1VkoXSTojtegfUjzoAvN8LDWO242kGDQ4gH2Y7hQJsGzOV3I2gGBZo7As1oerU0tyvA',
id: 'cd8856d7-f92e-XXXX-XXXX-5eaec904288f',
embedUrl: 'https://app.powerbi.com/reportEmbed?reportId=cd8856d7-f92e-XXXX-XXXX-5eaec904288f'
};
var report;
window.onload = function () {
var $reportContainer = $('#reportContainer');
report= powerbi.embed($reportContainer.get(0), embedConfiguration);
var Filter1 = {
$schema: "http://powerbi.com/product/schema#advanced",
target: {
table: "Table1",
column: "T1id"
},
logicalOperator: "OR",
conditions: [
{
operator: "Contains",
value: "id1"
}
]
}
var Filter2 = {
$schema: "http://powerbi.com/product/schema#advanced",
target: {
table: "Table2",
column: "T2id"
},
logicalOperator: "OR",
conditions: [
{
operator: "Contains",
value: "id1"
}
]
}
report.on('loaded', event => {
report.getFilters()
.then(filters => {
filters.push(Filter1);
filters.push(Filter2);
return report.setFilters(filters);
});
});
}
function reloadreport(){
var $reportContainer = $('#reportContainer');
powerbi.embedNew($reportContainer.get(0), embedConfiguration);
};
</script>
<button onclick="reloadreport()">Click me to refresh</button>
<div id="reportContainer"></div>
</html>
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |