Forum Discussion
Default Slicer Selection Based on User Locale
check link:
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:
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."
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")
Modify the UPN check based on your organization's domain or other criteria that indicate US users.
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"
)
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.