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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
basirve
Helper III
Helper III

Dynamic Row level security Overriding My Dax Formula

Dear Experts,
I have agent scorecord report and want to implement Dynamic row level Security.
Hierarchy is : Agent --> Supervisor --> Manger --> Director
When Agent Login and he can able to his data only 
When Supervisor/Manager/Director Logins, We want to show the under his employees.
Below Screenshot is not applied Security:
133--> Total employees at the Same job level.

basirve_0-1710844201115.png
when row Leve security enabled 
1--> Total employees at the Same job level. 
here we want to show 133 instead 1.

basirve_1-1710844569904.png
Dax Measure:


_Agent_Counts_Tier =
CALCULATE (
COUNT ( Dim_Agent[_Complete_Name] ),
FILTER (
ALL ( Dim_Agent ),
Dim_Agent[Job_Cd] = SELECTEDVALUE ( Dim_Agent[Job_Cd] )
&& Dim_Agent[is_Current] = TRUE ()
)
)


Can we write a dax to overwrite the row level security in this calculation.
I wrote some kid of measure but it doesnt work as expected.Could you please suggest/help me on this.
_Agent_Counts_Tier_Sec =
VAR EIN_Lookup_Var =
    LOOKUPVALUE (
        Dim_Agent[Job_Cd],
        Dim_Agent[Agent_Federation_ID], USERPRINCIPALNAME ()
    )
Return
CALCULATE (
    COUNT ( Dim_Agent[_Complete_Name] ),
    FILTER (ALL(Dim_Agent) ,PATHCONTAINS(Dim_Agent[Hierarchy_Job_Code],EIN_Lookup_Var))
--Dim_Agent[Job_Cd] = SELECTEDVALUE(Dim_Agent[Job_Cd]) &&
      ,Dim_Agent[is_Current] = TRUE()
           
    )

Thanks & Regards,
Venkat.

 



1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @basirve ,

 

You can compose a new table of people information as a slicer and create a MEASURE similar to the following:

vkongfanfmsft_0-1710919885797.png

result_ = 
VAR sel_ =
    SELECTEDVALUE ( Slier[Person] )
RETURN
    IF (
        sel_ = MAX ( Test[Agent] ),
        [result_Agent],
        IF ( sel_ = MAX ( Test[Manger] ), [result_Manger], BLANK () )
    )

vkongfanfmsft_1-1710919952713.png

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
basirve
Helper III
Helper III

Hi  v-kongfanf-msft,
We have to compare the Rank too based On the score (It is defined with multiple fact tables.)
Note: Agent Table connect with Multiple Fact table and when we applied the Row Level security it is filtered the data and for other User are filtered out.
Thanks & Regards,

Venkat.

Anonymous
Not applicable

Hi @basirve ,

 

You can compose a new table of people information as a slicer and create a MEASURE similar to the following:

vkongfanfmsft_0-1710919885797.png

result_ = 
VAR sel_ =
    SELECTEDVALUE ( Slier[Person] )
RETURN
    IF (
        sel_ = MAX ( Test[Agent] ),
        [result_Agent],
        IF ( sel_ = MAX ( Test[Manger] ), [result_Manger], BLANK () )
    )

vkongfanfmsft_1-1710919952713.png

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors