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
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.
- Shawn_Eary6 years agoAdvocate V
Shawn_Eary wrote: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.This trick is working for me when I use the Stacked Column chart visualization, but strangely, I can't use the Pie Chart visualization because when I add the isCurrentUser Measure to my Pie Chart visualization, the "Show items when the value:" DropDowns are strangely disabled. That isn't a big deal though because I can simply use the Stacked Column chart since it essentially displays the same information when I set rowUsername as the axis and filter to only select rows when isCurrentUser = 1. Unfortunately, I have a different issue now...
When I filter my Stacked Column chart to only display results when (isCurrentUser = 1), I get exactly one Stacked Bar that correponds to the current user. This is close to what I want, unfortunately, that Stacked Bar displays the summation of all graduated and notGraduated values for that current user. I don't want the summation, I simply want the latest value for the current user. To achieve that, I try to add a Top N Latest 1 query on the Created Field. Unfortunately, as soon as I apply that, my Stacked Bar chart dissappears because (in my particular case) the current user is not the the user that last submitted an entry to the studentSucess Table.
I need my (Top N Lastest 1) and (CurrentUser is 1) filters to work together so the Stacked column chart shows data from the latest row for the current user regardless wheither or not the current user is the one who created the latest entry.- Shawn_Eary6 years agoAdvocate V
I came close to getting a DAX forumula to resolve this but I kept getting hiccups. My present resolution is to simply use a UNIQUE constraint to only allow one row per user until I am more familiar with Power BI.