DAX measure not working when RLS is turned on - Join paths are expected to form a tree

半世苍凉 提交于 2020-04-11 17:12:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!