Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am building a custom connector and need to implement query folding when filter is added. What is the On* handler function name and its parameters for this? Is there any documentation on this and all available handler functions?
These doc doesn't contain everything.
https://learn.microsoft.com/en-us/power-query/samples/trippin/10-tableview1/readme
https://learn.microsoft.com/en-us/power-query/power-query-folding
Solved! Go to Solution.
The handler is
OnSelectRows = (condition as function) =>
let
ast = RowExpression.From(condition),
...
We can convert the condition into abstract syntax tree (AST) using:
RowExpression.From(function as function) as record
Example:
For
Table.SelectRows(table, each [Metric1]>=2000 or [Metric1]=null or [Metric1]=[Metric2])
AST is :
[ Kind = "Binary", Operator = "Or",
Left = [ Kind = "Binary", Operator = "Or",
Left = [ Kind = "Binary", Operator = "GreaterThanOrEquals",
Left = [ Kind = "FieldAccess", MemberName = "Metric1", Expression = RowExpression.Row ] ,
Right = [ Kind = "Constant", Value = 2000 ]
] ,
Right = [ Kind = "Binary", Operator = "Equals",
Left = [ Kind = "FieldAccess", MemberName = "Metric1", Expression = RowExpression.Row ] ,
Right = [ Kind = "Constant", Value = null ]
]
] ,
Right = [ Kind = "Binary", Operator = "Equals",
Left = [ Kind = "FieldAccess", MemberName = "Metric1", Expression = RowExpression.Row ] ,
Right = [ Kind = "FieldAccess", MemberName = "Metric2", Expression = RowExpression.Row ]
]
]
The handler is
OnSelectRows = (condition as function) =>
let
ast = RowExpression.From(condition),
...
We can convert the condition into abstract syntax tree (AST) using:
RowExpression.From(function as function) as record
Example:
For
Table.SelectRows(table, each [Metric1]>=2000 or [Metric1]=null or [Metric1]=[Metric2])
AST is :
[ Kind = "Binary", Operator = "Or",
Left = [ Kind = "Binary", Operator = "Or",
Left = [ Kind = "Binary", Operator = "GreaterThanOrEquals",
Left = [ Kind = "FieldAccess", MemberName = "Metric1", Expression = RowExpression.Row ] ,
Right = [ Kind = "Constant", Value = 2000 ]
] ,
Right = [ Kind = "Binary", Operator = "Equals",
Left = [ Kind = "FieldAccess", MemberName = "Metric1", Expression = RowExpression.Row ] ,
Right = [ Kind = "Constant", Value = null ]
]
] ,
Right = [ Kind = "Binary", Operator = "Equals",
Left = [ Kind = "FieldAccess", MemberName = "Metric1", Expression = RowExpression.Row ] ,
Right = [ Kind = "FieldAccess", MemberName = "Metric2", Expression = RowExpression.Row ]
]
]
Here is an article that may help explain further.
Pat
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
10 | |
7 | |
6 | |
6 | |
6 |