Forum Discussion
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
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.
Best Regards,
Dale
1 Reply
- v-jiascu-msft
Microsoft 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.
Best Regards,
Dale