Forum Discussion

johnwood's avatar
johnwood
New Member
10 years ago

Filter data on USERNAME()

Hi,

I am trying to implement the concept of a "MY" dashboard on a set of timesheet data.  The only way I think this can be done is via the USERNAME() function.  So far I have:

1. retreived a unique USERNAME() (this turns out to be a long hex string)

2. converted to the actual user name (as stored in the timesheet data) using a LOOKUPVALUE() function on a table I created, using a measure called CurrentUser

3. tried to find a method to create a filter based on matchng my CurrentUser measure to the actual data field which stores the user name in my timesheet data.  This is where I got stuck, I just cannot fogure out a way of doing this!

Any help most grateully received!

John

7 Replies

  • fbrossard's avatar
    fbrossard
    Kudo Commander

    The only way to filter data on UserName() is to use an Analysis Services Cube.

    1. Create an SSAS cube

    2. Implement the dynamic security with SSAS by using Roles based on the username() coupled to the LookupValue() DAX functions. 

    3. Install and configure the Enterprise Gateways to access to your cube, the credentials of the user will be passed through the cube.

    4. Create a PBIX on you cube by using Direct Connect create your report.

    5. Publish to the PBI Service

    6. Build your dahsboard

    7. Make a Content Pack and share it to the target users

    8. Each user can now use your content pack

    Data will then be filter for each user according to their credentials

    • johnwood's avatar
      johnwood
      New Member

      Many thanks fbrossard.

      I'm still a way away from the kind of solution you suggest...for the time being my users will have to filter on their name on screen!

      • greggyb's avatar
        greggyb
        Resident Rockstar

        If you publish your report as an Organizational Content Pack, your users will be able to Personalize a copy, and save it with the filter applied to their name. If the report design doesn't change often, this should be pretty convenient for them.

  • greggyb's avatar
    greggyb
    Resident Rockstar

    To my understanding the return value of USERNAME() in PBI Service shouldn't be used to identify individuals within an organization. I would love to hear otherwise.

  • If I understand correctly from the Data summit just held in Seattle, the next release of Power BI will have row-level security, which is what you're after, I think.