Forum Discussion
Filter Table by Username Without Row Level Security
- 6 years ago
I found the answer here:
https://community.powerbi.com/t5/Desktop/Error-on-using-UserName-function-in-custom-table/m-p/344243#M154360
v-jiascu-msft posted the answer. I just had a hard time understanding what v-jiascu-msft was saying.
Apparently, I should not try to use a calculated column, but instead use a measure. When I use a measure, however, I have to use a MIN or MAX function in the way that Dale (v-jiascu-msft) suggests.
I would argue that for situations like these where we want to avoid naked columns, we should maybe also have an IDENTITY function to go along with MIN and MAX. Maybe we could use the IDENTITY function whenever either MAX or MIN would work and it doesn't matter. Seems like using the IDENTITY function in those situations might make the code easier to read.
DAX serious confuses me. - Anonymous6 years ago
Hi Shawn_Eary,
The measure is an expression used to calculate based on corresponding row content. Its result will changes if row contents change.
You can't direct use table or columns in its expression except you enable aggregate functions or filters to the summary result value. (it calculate on filtered summarize values instead direct calculate on table fields)For the calculated column, it is a field stored on table so its calculate range is the whole table and requires calculating the result when the data model table updated. (BTW, you can directly use column fields to calculate in its expression)
You can take a look at the following link to know more about the difference between the calculated column and measure:
Calculated Columns and Measures in DAX
Username and other functions listed in the notification messages, they are extracted from AS tabular instance features/information. For these special functions, I think they are limited to use on minimum 'row' level(might be security reasons) and not allow to use in column and table level.
Regards,
Xiaoxin Sheng
Hello.
Did you find a solution? I have also tried to use the USERPRINCIPALNAME() to filter information that can be seen by the logged-in user and all the options I have tried failed.
It would be good if they enabled a solution for this, since there are many of us who need to filter by user without RSL.
It is possible to filter a visual (table, slicer, for the others I haven't tried) using userprincipalname() without using RLS. You have to use userprincipalname() within a measure and use that measure in the filter pane to filter the visual you want to filter. Not every measure works so of course you have to be a little bit clever when you build it.