Forum Discussion

Shawn_Eary's avatar
Shawn_Eary
Advocate V
6 years ago
Solved

Filter Table by Username Without Row Level Security

I have a table named studentSuccess that looks something like this (Data is Not Actual):   Id rowUserName Created  min GPA graduated Not Graduated currentUserName (Measure) 6 jeff...
  • Shawn_Eary's avatar
    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.


     

  • Anonymous's avatar
    Anonymous
    6 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