mirror of
https://github.com/storytold/gridcraft.git
synced 2026-12-02 02:33:55 -06:00
dax: bind every documented CROSSFILTER direction and RANK reset keyword (#2228)
This commit is contained in:
@@ -267,10 +267,18 @@ impl<'a> Binder<'a> {
|
||||
"CONVERT" if index == 1 => keyword_name(arg),
|
||||
// RANKX's Ties argument is documented as `Dense` but catalogued as a Scalar.
|
||||
"RANKX" if index == 4 => keyword_name(arg),
|
||||
// RANKX's Order argument is catalogued as a Scalar too, but it is `ASC`/`DESC`.
|
||||
"RANKX" if index == 3 => clause_keyword(arg, &["ASC", "DESC"]),
|
||||
"DATEDIFF" if index == 2 => keyword_name(arg),
|
||||
// TOPN's `(expression, Order)` pairs: ASC/DESC sit at every odd index from 3.
|
||||
"TOPN" if index >= 3 && index % 2 == 1 => clause_keyword(arg, &["ASC", "DESC"]),
|
||||
"CROSSFILTER" if index == 2 => clause_keyword(arg, &["ONE", "ONEWAY", "BOTH", "TWOWAY", "NONE"]),
|
||||
"CROSSFILTER" if index == 2 => {
|
||||
clause_keyword(arg, &["NONE", "ONE", "ONEWAY", "BOTH", "TWOWAY", "ONEWAY_LEFTFILTERSRIGHT", "ONEWAY_RIGHTFILTERSLEFT"])
|
||||
}
|
||||
// RANK/ROWNUMBER's Reset argument is `NONE`, `LOWESTPARENT` or `HIGHESTPARENT`,
|
||||
// catalogued as `Any` so that a relation expression still binds there.
|
||||
"RANK" if index == 6 => clause_keyword(arg, &["NONE", "LOWESTPARENT", "HIGHESTPARENT"]),
|
||||
"ROWNUMBER" if index == 5 => clause_keyword(arg, &["NONE", "LOWESTPARENT", "HIGHESTPARENT"]),
|
||||
// Window/relation clauses take bare enum words: `ORDERBY(x, DESC)`,
|
||||
// `WINDOW(1, ABS, 1, ABS, ...)`, `INDEX(..., KEEP, PARTITIONBY(...))`, and the
|
||||
// LOOKUP associated-columns behaviour (`INFERRED`).
|
||||
|
||||
@@ -37,10 +37,11 @@ pub static FUNCTIONS: &[FunctionSpec] = &[
|
||||
RELATIONSHIP_FLAGS,
|
||||
"Overrides the cross-filter direction of an existing relationship for the duration of \
|
||||
the filter context it modifies. The two column arguments identify the relationship \
|
||||
endpoints; the third argument is 0/1/2/3/4 or the words NONE, ONEWAY, BOTH or \
|
||||
TWOWAY. It changes filter propagation in both directions, never which relationship is \
|
||||
active, so it is used as a filter modifier inside CALCULATE and similar functions and \
|
||||
returns no value.",
|
||||
endpoints; the third argument is 0/1/2/3/4 or the words NONE, ONE, ONEWAY, BOTH, \
|
||||
TWOWAY, ONEWAY_LEFTFILTERSRIGHT or ONEWAY_RIGHTFILTERSLEFT (the last two flow from the \
|
||||
first column argument's table to the second's, or back). It changes filter propagation \
|
||||
in both directions, never which relationship is active, so it is used as a filter \
|
||||
modifier inside CALCULATE and similar functions and returns no value.",
|
||||
&[
|
||||
"CALCULATE ( [Sales Amount], CROSSFILTER ( Sales[CustomerKey], Customer[CustomerKey], BOTH ) )",
|
||||
"CALCULATE ( COUNTROWS ( Customer ), CROSSFILTER ( Sales[ProductKey], 'Product'[ProductKey], NONE ) )",
|
||||
|
||||
Reference in New Issue
Block a user