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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

USerprinciple Name

Hi Experts

 

I am using the following dax to restrict access to data in PBIX based on Country and Stores in the Country . But when i test the DAX in Managed Role it returns back nothing 

 

VAR _USERPRINCIPLENAME = "[country_dim.country_name];[bu_code]"

VAR SeparatorPosition = SEARCH(";",_USERPRINCIPLENAME)

VAR Country = LEFT(_USERPRINCIPLENAME, SeparatorPosition - 1)

RETURN

CONTAINSSTRING(Country, CONCATENATE("(", CONCATENATE([country_dim.country_name],")")))

Should tell me who is logged in???

1 ACCEPTED SOLUTION

sorry, my bad - I did not read your code careful enough. Apologies.

 

What locale are you using for your code?  Can you  show the data model to confirm that RLS is applied to the right table?

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

You have a typo.  It is spelled USERPRINCIPALNAME().

Anonymous
Not applicable

Hi Ibendlin - can you use a Function as a varibale???

sorry, my bad - I did not read your code careful enough. Apologies.

 

What locale are you using for your code?  Can you  show the data model to confirm that RLS is applied to the right table?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.