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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Oceans88
Helper III
Helper III

RLS / Multiple Accesses per User

Dear all,

 

Trying to resolve the following issue. 

1- In My User Access table i have pretty much 2 cloumns "EMAIL" / "INTEREST"

2- In my Fact table i have a concatenation of all multiple columns called "RLS" ( Example: one row will contain: "24532-France-Acessories-Products"

3- What i want to try to achive is that RLS will search that "RLS" column in my fact table thus filtering the nessecery items.

4- Each user might have access to multiple arease ( E.g. Countries, product groups, etc....)

 

This was one of my best tries and worked until a user has multiple values(It will give an Error). Here i have not gotten to the part of searching a string bacuase at this point"RLS" has only one value

 

 

VAR USER_Object = 
calculatetable(
Values('55_Subscription'[Interest]),
'55_Subscription'[Email] = USERPRINCIPALNAME()
)

VAR RLS= 
Switch(TRUE(),
USER_Object = "ALL", TRUE(),
[RLS] = USER_Object, True(),
False()
)
Return
RLS

 

 

 

 

This one just didnt return anything. 

 

 

[RLS]
    IN CALCULATETABLE (
        VALUES ('55_Subscription'[Interest]),
        FILTER (
            ALL ('55_Subscription'),
            [Email] = USERPRINCIPALNAME()
        )
    )

 

 

 

 

Anyone have any idea on how i can solve? 

 

Thank you

 

 

 

1 ACCEPTED SOLUTION

Hi @Oceans88 ,

 

If there are multiple condtions in your data model, I suggest you to combine them in one column as the key column.

For example, format should look like "UserID - Country - Acessories - Products".

My Sample:

55_Subscription:

RicoZhou_0-1656915391680.png

Data:

RicoZhou_1-1656915398750.png

Relationship:

RicoZhou_2-1656915430191.png

Code in Manage roles:

[Email] = USERPRINCIPALNAME()

RicoZhou_3-1656915477522.png

[Combine Key] =
SWITCH (
    TRUE (),
    [Combine Key]
        IN CALCULATETABLE (
            VALUES ( '55_Subscription'[INTEREST] ),
            FILTER ( '55_Subscription', '55_Subscription'[Email] = USERPRINCIPALNAME () )
        ), [Combine Key],
    BLANK ()
)

 

RicoZhou_4-1656915486575.png

Result is as below.

View as User A:

RicoZhou_5-1656915514480.png

View as User B:

RicoZhou_6-1656915538625.png

 

Best Regards,
Rico Zhou

 

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

6 REPLIES 6
Oceans88
Helper III
Helper III

Here is where im at, but im a bit stuck. When i run it gives me the error of:

"Table of multiple values was supplied where a single value was expected"

 

CONTAINSSTRING([RLS],
CALCULATETABLE (
        VALUES ('55_Subscription'[Interest]),
        FILTER (
            ALL ('55_Subscription'),
           CONTAINSSTRING( [Email], USERPRINCIPALNAME())
        )
    )
)

 

Update:

CONTAINSSTRING([RLS],
CALCULATETABLE (
        FIRSTNONBLANK ('55_Subscription'[Interest],1),
        FILTER (
            ALL ('55_Subscription'),
           CONTAINSSTRING( [Email], USERPRINCIPALNAME())
        )
    )
)

 

 

Ok Heres my progress, i was able to get it to work using CONTAINSSTRING by using FIRSTNONBLANK, but due to this im only able to see the first filter on RLS only so for example: If i should see 2 countrys eorth of data im only seeing one. DOes someone know how toovercome this? 

 

Thank you & Regards 

Hi @Oceans88 ,

 

If there are multiple condtions in your data model, I suggest you to combine them in one column as the key column.

For example, format should look like "UserID - Country - Acessories - Products".

My Sample:

55_Subscription:

RicoZhou_0-1656915391680.png

Data:

RicoZhou_1-1656915398750.png

Relationship:

RicoZhou_2-1656915430191.png

Code in Manage roles:

[Email] = USERPRINCIPALNAME()

RicoZhou_3-1656915477522.png

[Combine Key] =
SWITCH (
    TRUE (),
    [Combine Key]
        IN CALCULATETABLE (
            VALUES ( '55_Subscription'[INTEREST] ),
            FILTER ( '55_Subscription', '55_Subscription'[Email] = USERPRINCIPALNAME () )
        ), [Combine Key],
    BLANK ()
)

 

RicoZhou_4-1656915486575.png

Result is as below.

View as User A:

RicoZhou_5-1656915514480.png

View as User B:

RicoZhou_6-1656915538625.png

 

Best Regards,
Rico Zhou

 

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

Hi Rico, 

 

Million thanks for your time and effort for looking into this. Very Helpful info. Appologize for the delay. Tuff work week. This indeed works. But what if i would want to instead make search inside of that "Combine Key" Column that you have created for a specific string. 

Imagine that this is my subscription table below and i would just release the data upon finding that interest keyword withing "Combine Key". 

 

Oceans88_0-1657292250088.png

 

THank you & regards

Oceans88
Helper III
Helper III

Just an Update, the following code is actually working to eliminate the issue of "multiple values when single value was excpected. 

 

[Region] //I changed this to a region filter (Non-concatenated) and it worked. 
    IN CALCULATETABLE (
        VALUES ('55_Subscription'[Interest]),
        FILTER (
            ALL ('55_Subscription'),
            [Email] = USERPRINCIPALNAME()
        )
    )

 

Now i need to add a search function and use [RLS] column in fact table (which contains concatenated values). Maybe i can add a Containsstring function somewhere in there? 

 

Any ideas?

 

Kr

Any ideas on what i could do to resolve ?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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