Forum Discussion
Using FILTER with CROSSFILTER and USERELATIONSHIP
Is there a way to use FILTER with inactive relationships?
I have the following formula and it does not work.
7 Replies
- AnonymousNot applicable
markpatton - can you please share an example pbix file?
- markpattonHelper I
I'd love to but the data is confidential. I'll try to produce a test file. edhans I tried the formula and got the error "The expression refers to multipe columns. Multiple columns cannot be converted to a scaler value"
- edhansCommunity Champion
Sorry - ISBLANK needs a scalar value, not a table. This will fix that.
Owner Other = CALCULATE( SUM( 'GL - GENERAL LEDGER DETAILS'[Line Amount] ), CROSSFILTER ( 'RLS-Plane ID'[registration], 'Trip filters'[Plane], NONE ), USERELATIONSHIP ( 'RLS-Plane ID'[registration], 'GL - Customers'[CustomerPlane] ), 'GL - Customers'[Customer Type] = "Owner", 'GL - Account'[Account Number] = "11000", ISBLANK( COUNTROWS( CALCULATETABLE( 'GL - GENERAL LEDGER DETAILS', TREATAS( VALUES( 'GL - Customers'[CustomerPlane] ), 'Trip filters'[Plane] ) ) ) ) ) * -1
- edhansCommunity Champion
Hard to know without data, but try this:
Owner Other = CALCULATE( SUM( 'GL - GENERAL LEDGER DETAILS'[Line Amount] ), CROSSFILTER ( 'RLS-Plane ID'[registration], 'Trip filters'[Plane], NONE ), USERELATIONSHIP ( 'RLS-Plane ID'[registration], 'GL - Customers'[CustomerPlane] ), 'GL - Customers'[Customer Type] = "Owner", 'GL - Account'[Account Number] = "11000", ISBLANK( CALCULATETABLE( 'GL - GENERAL LEDGER DETAILS', TREATAS( VALUES( 'GL - Customers'[CustomerPlane] ), 'Trip filters'[Plane] ) ) ) ) * -1
TREATAS doesn't use the model for relationships, so I've created a virtual relationship, applied it to the GL table, and am expecting a blank - i.e. no records returned. If records are returned, it is because customerplane matches (filters) Plane. - markpattonHelper I
edhans with that change I now get "The True/False expression does not specify a column. Each True/False expressions used as a table filter expression must refer to exactly one column."
I'm working on a test pbix. Hopefully I get the same results with test data.