Below code works in my test. You can debug your filter by using the alert statement before applying it. Check more details on Filters. By the way, do note that when using "In", it is values and when other operators it is a scalar value. You may have to put more logics in your function.
var arr = [1,2,3,4,6,8] function advancedFilter(table, column, logicalOperator, operator, value){ if (logicalOperator === undefined) { logicalOperator = "And"; } if (operator === undefined) { operator = "Is"; } if (value === undefined) { value = 0; } return filter = { $schema: "http://powerbi.com/product/schema#advanced", target: { table: table, column: column }, //logicalOperator: logicalOperator, //conditions: [ // { operator: operator,
//It is "values" when using a operator "In"values: value // } //] }; } alert(JSON.stringify(advancedFilter("table","column","","In",arr)));