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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
kabra_ashish
Helper III
Helper III

Rank function bypasses row level security

Assuming I have the below table with the rankings:

 

Country         Customer_ID         Total_Spend      Rank

USA                 U_ABC                          $100             1

USA                 U_DEF                           $200             2

USA                 U_GHI                           $300             3

Germany          G_JKL                            $100             4

Germany          G_XYZ                           $100             5

 

I have the Row-level security implemented in my data model based on country. When the users who have access to only Germany the rank for the customers  appears as G_JKL is 4 and G_XYZ = 5 whereas I want them to be 1 and 2 respectively. It seems that rank does not re-calculate on the basis of row-level security of filters? Instead it takes the entire data.

 

Can someone please help me out here? Basically I am looking the rank to be re-calculated on the basis of row-level security

 

1 ACCEPTED SOLUTION
DataZoe
Microsoft Employee
Microsoft Employee

@kabra_ashish 

 

Here is a measure version that utilizes that rank column to give you the result when filtered to by RLS to Germany:

 

rankx.JPG

 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

4 REPLIES 4
DataZoe
Microsoft Employee
Microsoft Employee

@kabra_ashish 

 

Here is a measure version that utilizes that rank column to give you the result when filtered to by RLS to Germany:

 

rankx.JPG

 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

amitchandak
Super User
Super User

@kabra_ashish , If you have created a column, it will not change. Create a measure with allselected.

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Greg_Deckler
Super User
Super User

@kabra_ashish - If Rank is a column, that is correct. Columns calculate at the time of data load and thus are not impacted by dynamic things like slicers or RLS. You need to implement your rank as a measure.

 

This may help: https://community.powerbi.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1042520#M452



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Question, can you use a measure to rank ignoring the RLS applied? To generate this rank table below, but when Germany access only sees rank 4 and 5.

 

Country         Customer_ID         Total_Spend      Rank

USA                 U_ABC                          $100             1

USA                 U_DEF                           $200             2

USA                 U_GHI                           $300             3

Germany          G_JKL                            $100             4

Germany          G_XYZ                           $100             5

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.