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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
charlottesmn
Frequent Visitor

Pass array in dynamic RLS with USERNAME()

Hello!

I have a report with a customer dimension table and an order fact table. The two have a relationship one to many.
CUSTOMER:

customer_idcustomer_namecustomer_last_namecustomer_first_name
00000152xx, yyxxyy
15478965qq, ooqqoo
12365478aa, llaall

FACT:

order_idcustomer_idorder_date......
12365400000152   
78965415478965   
14785212365478   

 

This report is embedded and I have set up dynamic RLS on the customer table as: customer_id = USERNAME() such that when a customer logs in to the website its username is returned and passed, filtering the customer table which filters the fact table with its order.

I now have a use case where instead of returning a single customer_id, the USERNAME() function will return a list of IDs (for example IDs it has been assigned to in the past because of some merged ids). How can I update the RLS to work with an array? 

For example, when customer 00000152 logs in it is associated with [00000152, 15478965] IDs and so both IDs should be visible. 

Thank you!

1 REPLY 1
Anonymous
Not applicable

Hi @charlottesmn ,

Given your scenario, you'll need to adjust your RLS formula to accommodate multiple IDs.

You'll need to use the function in combination with a delimiter to separate IDs in the string returned by . Assuming returns a string like "00000152,15478965", you can use the following DAX expression:

CONTAINSSTRING(CONCATENATE(",", USERNAME()), CONCATENATE(",", [customer_id], ","))

CONTAINSSTRING function (DAX) - DAX | Microsoft Learn

USERNAME function (DAX) - DAX | Microsoft Learn

 

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

 

If it does not help, please provide more details.

 

Best Regards
Community Support Team _ Rongtie

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

 

 

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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