Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

RLS And USERELATIONSHIP

Hello Everyone.

 

I have this Relationship between two tables:

BiDevOO_0-1696259896491.pngBiDevOO_1-1696259908561.png

 

I created those measures:

BiDevOO_2-1696260001062.pngBiDevOO_3-1696260018208.png


It works Perfect but when i Implement RLS Role i get this Error:

BiDevOO_4-1696260064091.png



I understand that it happends because i am filtering my Dim Table but i dont know how to fix it,  I know i can split the main table into two tables but maybe some one have better idea?

Thank you.

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

HI @Anonymous,

I mean you can extract the corresponding item list from the target table without active fact relationship. Then you can use this list as condition in your Dax expression to filter calculation records.

formula =
VAR IDlist =
    CALCULATETABLE (
        VALUES ( 'DWH Dim_Neighborhoods'[NeighborhoodID] ),
        ALLSELECTED ( 'DWH Dim_Neighborhoods' ),
        VALUES ( 'DWH Dim_Neighborhoods'[NeighberhoodNameHEB] )
    )
RETURN
    CALCULATE (
        SUM ( 'DWH Fact_ImigrationInCity'[Quantity] ),
        FILTER (
            ALLSELECTED ( 'DWH Fact_ImigrationInCity' ),
            'DWH Fact_ImigrationInCity'[NeigheberhoodTargetID] IN IDlist
        )
    )

Regards,

Xiaoxin Sheng

View solution in original post

Anonymous
Not applicable

Thank you!

formula =
VAR IDlist =
    CALCULATETABLE (
        VALUES ( 'DWH Dim_Neighborhoods'[NeighborhoodID] ),
        ALL ( 'DWH Dim_Neighborhoods'[NeighberhoodNameENG] )
    )
RETURN
    CALCULATE (
        SUM ( 'DWH Fact_ImigrationInCity'[Quantity] ),
        FILTER (
            ALLEXCEPT( 'DWH Fact_ImigrationInCity','DWH Dim_Date'),
            'DWH Fact_ImigrationInCity'[NeigheberhoodTargetID] IN IDlist
        )
    )
I made some changes and now it work, Thanks again!!

View solution in original post

6 REPLIES 6
Villezekeviking
Most Valuable Professional
Most Valuable Professional

An alternative solution can be found here.

https://www.villezekeviking.com/alternative-to-userelationship/

Anonymous
Not applicable

HI @Anonymous,

Perhaps you can try to extract the value from other table and manually apply in expression calculations instead of use relationship functions. They should not affect the RLS usages.

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Thanks for your cooment.

 

I tried this DAX code:
#test = CALCULATE( sum('DWH Fact_ImigrationInCity'[Quantity]), FILTER( 'DWH Fact_ImigrationInCity', 'DWH Fact_ImigrationInCity'[NeigheberhoodTargetID] = CALCULATE( MAX('DWH Dim_Neighborhoods'[NeighborhoodID]), 'DWH Dim_Neighborhoods'[NeighberhoodNameHEB] = SELECTEDVALUE('DWH Dim_Neighborhoods'[NeighberhoodNameHEB])) ),ALL('DWH Fact_ImigrationInCity') )

thats what you mean?
it doesnt works for me.

Anonymous
Not applicable

HI @Anonymous,

I mean you can extract the corresponding item list from the target table without active fact relationship. Then you can use this list as condition in your Dax expression to filter calculation records.

formula =
VAR IDlist =
    CALCULATETABLE (
        VALUES ( 'DWH Dim_Neighborhoods'[NeighborhoodID] ),
        ALLSELECTED ( 'DWH Dim_Neighborhoods' ),
        VALUES ( 'DWH Dim_Neighborhoods'[NeighberhoodNameHEB] )
    )
RETURN
    CALCULATE (
        SUM ( 'DWH Fact_ImigrationInCity'[Quantity] ),
        FILTER (
            ALLSELECTED ( 'DWH Fact_ImigrationInCity' ),
            'DWH Fact_ImigrationInCity'[NeigheberhoodTargetID] IN IDlist
        )
    )

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

I really appreciate it, Thank you.

 

It works good but i slice my graph also with Date table, What should i add to the formula that it will work also with slice the graph by years?

this is the date table column name :

'DWH Dim_Date'[Year]
 

 

Anonymous
Not applicable

Thank you!

formula =
VAR IDlist =
    CALCULATETABLE (
        VALUES ( 'DWH Dim_Neighborhoods'[NeighborhoodID] ),
        ALL ( 'DWH Dim_Neighborhoods'[NeighberhoodNameENG] )
    )
RETURN
    CALCULATE (
        SUM ( 'DWH Fact_ImigrationInCity'[Quantity] ),
        FILTER (
            ALLEXCEPT( 'DWH Fact_ImigrationInCity','DWH Dim_Date'),
            'DWH Fact_ImigrationInCity'[NeigheberhoodTargetID] IN IDlist
        )
    )
I made some changes and now it work, Thanks again!!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.