问题
In Power BI, I have the following error for a measure when RLS is turned on (this error does not show when RLS is off):
Join paths are expected to form a tree but the table has two join paths
These are the relevant relationships in the model:
I have an inactive relationship. This inactive relationship is used in the measure with the problem. But as it is inactive, I would have thought it wouldnt be an issue?? The measure is:
TTipsInvs =
VAR SalesValue =
CALCULATE (
SUM ( ANSAPBICustomerTransDetailed[Outstanding] ),
USERELATIONSHIP ( 'ANSAPBICustomerTransDetailed'[SiteID], ANSAPBISites[Site ID] )
)
RETURN
IF ( ISBLANK ( SalesValue ), 0, ( SalesValue ) )
Any way to avoid this issue when RLS is turned on?
Cheers for all help
回答1:
TTipsInvs =
VAR SiteID =
CALCULATETABLE (
VALUES ( ANSAPBISites[Site ID] ) )
VAR SalesValue =
CALCULATE (
SUM ( ANSAPBICustomerTransDetailed[Outstanding] ),
TREATAS ( SiteID, 'ANSAPBICustomerTransDetailed'[SiteID] ) )
RETURN
IF ( ISBLANK ( SalesValue ), 0, ( SalesValue ) )
回答2:
Did a quick test: And this looks to work without the need of enabling or disabling relationships.
Before RLS:
After RLS:
来源:https://stackoverflow.com/questions/55744321/dax-measure-not-working-when-rls-is-turned-on-join-paths-are-expected-to-form