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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kewaynes
Helper III
Helper III

Default Slicer Selection Based on User Locale

Hi,

 

I have a report that allows the user to switch the unit of measurement between Metric and US. The report is defaulted to Metric. However, as you could imagine, we would prefer to have it default to US for users in the US. 

 

Is there a way to use something like the browser's locale to determine what a slicer's default value is?

 

I know that as a workaround, user specificied bookmarks may work. However, I believe that in our current embed environment, user bookmarks wouldn't be possible (or at least very difficult...) to implement.

4 REPLIES 4
v-tangjie-msft
Community Support
Community Support

Hi @kewaynes ,

 

It seems impossible.

If you would like to suggest  feature improvements, you may vote the idea and comment here to improve this feature. It is a place for customers provide feedback about Microsoft Office products . What’s more, if a feedback is high voted there by other customers, it will be promising that Microsoft Product Team will take it into consideration when designing the next version in the future.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Thanks for confirming. 

 

I'm working on a workaround where the values and labels will default to a unit of measure based on the browser locale. And then if they select a Unit of Measure on the slicer it will change to that value. It makes the DAX more complicated and is not a perfect solution but it seems to be the best solution with the current capabilites.

 

But yes, I think submitting this as an idea is a good suggestion. 

123abc
Community Champion
Community Champion

check link:

https://www.youtube.com/watch?v=JlVHsZUk1nc&pp=ygU2RGVmYXVsdCBTbGljZXIgU2VsZWN0aW9uIEJhc2VkIG9uIFVzZ...

 

OR

 

https://www.youtube.com/watch?v=um0dTXZhuek

 

OR

 

To default a slicer selection based on the user's locale in Power BI, you can use Power BI's built-in parameter and DAX functions along with a measure that determines the user's locale. Here's a step-by-step guide on how to achieve this:

  1. Create a Parameter for Unit of Measurement:

    • In Power BI Desktop, go to the "Model" view.
    • Right-click on the empty space and select "New Parameter."
    • Name it something like "Unit of Measurement."
    • Add two values: "Metric" and "US."
  2. Create a Measure to Determine User Locale:

    • You can use the USERPRINCIPALNAME() function to get the user's UPN (User Principal Name).
    • Create a DAX measure that analyzes the UPN to determine if the user is from the US or another region. You can use the CONTAINSSTRING function to check for US domains, for example.

UserLocale = IF(CONTAINSSTRING(USERPRINCIPALNAME(), "@yourUSdomain.com"), "US", "Other")

 

  1. Modify the UPN check based on your organization's domain or other criteria that indicate US users.

  2. Set Default Slicer Selection:

    • Go to the report page where you have the slicer for unit of measurement.
    • In the slicer visual, go to the "Format" pane.
    • Under "General," you'll find an option called "Default Value."
    • Set the default value to be a DAX expression, and use a switch statement to select the value based on the user's locale measure.

Default Value =
SWITCH(
[UserLocale],
"US", "US",
"Metric"
)

 

  1. Test Your Report:

    • Now, when a user accesses the report, the slicer's default value will be determined based on their locale, as per your DAX measure logic.

This approach uses a parameter to control the slicer's default selection and a DAX measure to determine the user's locale based on their UPN. Make sure you adapt the UPN check to match your actual user domain(s). Keep in mind that this method assumes that your users are accessing the report through Power BI Service or Power BI Report Server, and you have integrated authentication to identify users' UPNs.

User-specific bookmarks would be an alternative approach if you could implement them, but the above method should work in your situation.

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

Thanks for the quick response and all the info. Would you be able to attach some screenshots for the steps of setting the 'Default Value' for the slicer? I am having trouble finding that in my desktop app.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.