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
Kpham
Resolver I
Resolver I

Page Level Security workaround in Power BI

https://youtu.be/an7n2kSTBk0

 

I'm trying to implement the Page Level Security Workaround in Power BI from RADACAD, but i'm running into an error: 

A table of multiple values was supplied where a single value was expected. 
The dax synthax that i'm using is the one below. And I'm guessing the error comes from var _LookUpSecurity. I have a table with all the user principal names(UPN) and the reports that they allowed to view. So if I lookup the value "10.001 Order Book"  then it returns with a list of the UPN's. 

 

Measure = 
var _SalesAV=SUM('SD SalesDocumentItems'[Net Value Base Currency])
var _LookUpSecurity=LOOKUPVALUE('Page Navigation UPN'[group.member.userPrincipalName],'Page Navigation UPN'[Report ],"10.001 Order Book")
return
if(_LookUpSecurity=[User Logged In],_SalesAV)

 

 

1 ACCEPTED SOLUTION

Hi  @Kpham ,

You can update the measure as below and check if it can work...

Measure =
VAR _SalesAV =
SUM ( 'SD SalesDocumentItems'[Net Value Base Currency] )
VAR _LookUpSecurity =
CALCULATE (
MAX ( 'Page Navigation UPN'[group.member.userPrincipalName] ),
FILTER (
'Page Navigation UPN',
'Page Navigation UPN'[Report ] = "10.001 Order Book"
)
)
RETURN
IF ( _LookUpSecurity = [User Logged In], _SalesAV )

And if the table 'Page Navigation UPN' have multiple [group.member.userPrincipalName] values when the value of field [Report ] is  "10.001 Order Book", please update it as below:

Measure =
VAR _SalesAV =
SUM ( 'SD SalesDocumentItems'[Net Value Base Currency] )
VAR _LookUpSecurity =
CALCULATETABLE (
VALUES ( 'Page Navigation UPN'[group.member.userPrincipalName] ),
FILTER (
'Page Navigation UPN',
'Page Navigation UPN'[Report ] = "10.001 Order Book"
)
)
RETURN
IF ( [User Logged In] IN _LookUpSecurity, _SalesAV )

If the above one can't help you get the desired result, please provide some sample data in your tables 'SD SalesDocumentItems' and 'Page Navigation UPN' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

Best Regards

Community Support Team _ Rena
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

3 REPLIES 3
amitchandak
Super User
Super User

@Kpham , Try like

 

Measure =
var _SalesAV=SUM('SD SalesDocumentItems'[Net Value Base Currency])
var _LookUpSecurity=Maxx(filter('Page Navigation UPN', 'Page Navigation UPN'[Report ],"10.001 Order Book"),'Page Navigation UPN'[group.member.userPrincipalName])
return
if(_LookUpSecurity=[User Logged In],_SalesAV)

Kpham_0-1657276678993.png

Hello, thanks for looking into it but unfortunately not the solution

Hi  @Kpham ,

You can update the measure as below and check if it can work...

Measure =
VAR _SalesAV =
SUM ( 'SD SalesDocumentItems'[Net Value Base Currency] )
VAR _LookUpSecurity =
CALCULATE (
MAX ( 'Page Navigation UPN'[group.member.userPrincipalName] ),
FILTER (
'Page Navigation UPN',
'Page Navigation UPN'[Report ] = "10.001 Order Book"
)
)
RETURN
IF ( _LookUpSecurity = [User Logged In], _SalesAV )

And if the table 'Page Navigation UPN' have multiple [group.member.userPrincipalName] values when the value of field [Report ] is  "10.001 Order Book", please update it as below:

Measure =
VAR _SalesAV =
SUM ( 'SD SalesDocumentItems'[Net Value Base Currency] )
VAR _LookUpSecurity =
CALCULATETABLE (
VALUES ( 'Page Navigation UPN'[group.member.userPrincipalName] ),
FILTER (
'Page Navigation UPN',
'Page Navigation UPN'[Report ] = "10.001 Order Book"
)
)
RETURN
IF ( [User Logged In] IN _LookUpSecurity, _SalesAV )

If the above one can't help you get the desired result, please provide some sample data in your tables 'SD SalesDocumentItems' and 'Page Navigation UPN' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

Best Regards

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

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.