Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Filter to current user by default

I'm trying to enhance a report such that, when the user first opens it, it is filtered to just show their data, but they can then easily flip between just their data, and that for everyone.

 

I've tried using USERPRINCIPALNAME() to create a measure, which works with only limited success, as I can't then use this measure in a slicer so that it applies as a filter accross the whole report.

 

User Scope = if(
    MAXX(
        KEEPFILTERS(VALUES('Table1'[UserName])),
        CALCULATE(MIN('Table1'[UserName]))
    ) = USERPRINCIPALNAME(),
    "Just Me",
    "Everyone"
)

 

Other methods I've seen discussed mention row-level security - this does not sound suitable in my case, as I am not looking to restrict access.

 

Any suggestions?

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    You can't have a measure in a slicer. A slicer is taking its data from a table.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous wrote:

      You can't have a measure in a slicer. A slicer is taking its data from a table.


      Yes, that's my understanding, thanks for confirming. USERPRINCIPALNAME() can be used in a measures but not columns, and slicers and page/report level filters can use columns but not measures. It's like there's a wall between what the features/functions will do and the functionality I'm trying to achieve - very frustrating!