Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AdamWhittaker
Helper I
Helper I

Create a slicer for My records (USERPRINCIPALNAME = Submitter email)

Hello, is there a way to create a slicer to show records where one field = my username (its a one table dashboard)? I want to give users an Option of selecting their records vs everyone elses.

My idea was to create this measure then shove it in a slicer but it wont allow it:

My Records =
IF(SELECTEDVALUE('RecordTable'[Submitter email])=USERPRINCIPALNAME(),"My Records", "All")
 
If i shove this measure in a table then it correctly identifies the rows but how do I get it into a slicer?
 
Thanks,
3 REPLIES 3
AdamWhittaker
Helper I
Helper I

@AllisonKennedy  Thank you for the info, unfortunately USERPRINCIPALNAME() cannot be used in a calculated column so it looks like I have no choice to use bookmarks along with visual level filters (which is not ideal). Wonder why you cant use measures on the page filter level but you can on the visual level?

Sorry for the EXTREME delay in this reply. 

 

Just in case anyone still uses this post, the reason you can't use measures as page level filters is because of context - the measure evaluates to a single value, that value depends on the slicers and filter context of the visual the measure is used in. If you applied a filter at the page level, you don't have enough context to know which values to filter out. Would be cool if it was smart enough to know that you wanted to apply it individually to the context of all the visuals and do this a separate filters, though this could potentially get slow and have performance implications. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

AllisonKennedy
Super User
Super User

@AdamWhittaker Great question - I have been pondering something very similar for a project I'm working on.

 

Measures can't be used in Slicers, so you need to either use bookmarks and visual level filters, or create a calculated column. 

 

You would ideally have a User or Submitter dimension table, related to the RecordTable by [SubmitterEmail]. If not, you can just do this on the RecordTable, but that's not the ideal star schema.

 

In any case, create a new calculated column:

Submitter Filter = 

SWITCH ( TRUE(),

TableName[SubmitterEmail] = USERPRINCIPALNAME(), "My Records",
"Others Records" --You could also use the SubmitterEmail here - uncomment the line below and comment out this line

-- TableName[SubmitterEmail]
)


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.