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
mohdabdulazeem
Regular Visitor

Assigning [USERPRINCIPALNAMES] to a variable in a DAX meant for building a calculated table

Hi

 

Please excuse me if my message is breaking any guidelines.

 

I have a question whether it is possible to assign the [USERPRINCIPALNAMES]  to a variable ? the DAX i am using to build the table is given below

 

UsermsAccess = var loginuser = [USERPRINCIPALNAMES]  return FILTER(tableA,tableA[column]=loginuser )

 

here i am getting the error that  [USERPRINCIPALNAMES]   cannot be used in calculated column/tables and can be used in measure.

 

any suggestion in achieving the above will be hugely appreciated.

 

 

Thanks

Mohammed Abdul Azeem

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi Mohammed,

 

It isn't supported in your scenario. Maybe you can try the RLS function to achieve your goal.

The reason could be as follows. The underlying data of a report is static in Power BI. We can't change the dataset like that. For example, you are surfing the report and that table only has 5 rows. At the same time, another user opens the report. There is a collision now. What should that table be? The RLS is the solution for this scenario. All the data are there, but users only see what is allowed by the RLS rules. 

Assigning-USERPRINCIPALNAMES-to-a-variable-in-a-DAX-meant-for-building-a-calculated-table

 

Best Regards,
Dale

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

1 REPLY 1
v-jiascu-msft
Employee
Employee

Hi Mohammed,

 

It isn't supported in your scenario. Maybe you can try the RLS function to achieve your goal.

The reason could be as follows. The underlying data of a report is static in Power BI. We can't change the dataset like that. For example, you are surfing the report and that table only has 5 rows. At the same time, another user opens the report. There is a collision now. What should that table be? The RLS is the solution for this scenario. All the data are there, but users only see what is allowed by the RLS rules. 

Assigning-USERPRINCIPALNAMES-to-a-variable-in-a-DAX-meant-for-building-a-calculated-table

 

Best Regards,
Dale

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