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
Anonymous
Not applicable

How to Change the Default Slicer Selection based on User login from different Geographic Location?

Hi Everyone,

 

I have a User Table mapped with their Geographic Location in Power BI. When the Individual user login to Power BI, the default slicer selection of the "Country Slicer" should be changed into the Geographic location from where he belongs to. 

 

(Say) For Example, When the User from Sweden tries to login, the Country Slicer value should be defaulted to "Sweden" and also he should be given the flexibility to switch between the Other country values in the Slicer.

 

Can we achieve this in Power BI or not? If so, Please help me out in implementing this. 

Thankyou all in advance!!

1 ACCEPTED SOLUTION

Hi  @Anonymous 

It is difficult to dynamically update the slicer value.

As a workaround, you can add one record "current login country "  as below:

 

 

Slicer Table = 
VAR tab =
    ADDCOLUMNS (
        DISTINCT ( 'Fact Table'[Country] ),
        "Rank", RANKX ( DISTINCT ( 'Fact Table'[Country] ), 'Fact Table'[Country],, ASC ) + 1
    )
RETURN
    UNION (
        tab,
        DATATABLE ( "Country", STRING, "Rank", STRING, { { "Current login country", "1" } } )
    )

 

 

49.png

Then create a measure  and apply it to your table visual filter pane.

 

 

visual filter pane =
VAR country_slicer =
    SELECTEDVALUE ( 'Slicer Table'[Country] )
VAR country_table =
    SELECTEDVALUE ( 'Fact Table'[Country] )
VAR country_login =
    CALCULATE (
        MAX ( 'User Table'[Country] ),
        FILTER ( 'User Table', 'User Table'[User] = USERPRINCIPALNAME () )
    )
RETURN
    IF (
        ISFILTERED ( 'Slicer Table' ),
        IF (
            country_slicer = "Current country",
            IF ( country_table = country_login, 1, 0 ),
            IF ( country_table = country_slicer, 1, 0 )
        ),
        1
    )

 

 

50.png

 

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

8 REPLIES 8
ArunRohilla
New Member

Just use Pre-selected filter from the market. It's free and easy to use.

 

Kindly accept this as the solution if it works for you. 🙂

Anonymous
Not applicable

Hi Everyone,

 

Still I am indeed of the help on this requirement. I can able to get the User and Location Details from the User Table using DAX. My question is How to set up the default value in the Slicers based on the geographic location of the users login to Power BI and how to dynamically update the slicer value for every user? 

 

I wanted to know whether this is possible in Power BI or not? If so, please provide your help !!

Thanks in advance !!

Hi  @Anonymous 

It is difficult to dynamically update the slicer value.

As a workaround, you can add one record "current login country "  as below:

 

 

Slicer Table = 
VAR tab =
    ADDCOLUMNS (
        DISTINCT ( 'Fact Table'[Country] ),
        "Rank", RANKX ( DISTINCT ( 'Fact Table'[Country] ), 'Fact Table'[Country],, ASC ) + 1
    )
RETURN
    UNION (
        tab,
        DATATABLE ( "Country", STRING, "Rank", STRING, { { "Current login country", "1" } } )
    )

 

 

49.png

Then create a measure  and apply it to your table visual filter pane.

 

 

visual filter pane =
VAR country_slicer =
    SELECTEDVALUE ( 'Slicer Table'[Country] )
VAR country_table =
    SELECTEDVALUE ( 'Fact Table'[Country] )
VAR country_login =
    CALCULATE (
        MAX ( 'User Table'[Country] ),
        FILTER ( 'User Table', 'User Table'[User] = USERPRINCIPALNAME () )
    )
RETURN
    IF (
        ISFILTERED ( 'Slicer Table' ),
        IF (
            country_slicer = "Current country",
            IF ( country_table = country_login, 1, 0 ),
            IF ( country_table = country_slicer, 1, 0 )
        ),
        1
    )

 

 

50.png

 

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Will this work? when the user multi-selected the slicer

v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

It is currently difficult for PowerBI to automatically identify the  Geographic Location of the logged-in user.

You may need to create a user table that contains information such as users, tenants, and countries.

So that you can get the current user principal name  and find the corresponding country in the user table to filter data.

 

Best Regards,
Community Support Team _ Eason

 

Pragati11
Super User
Super User

Hi @Anonymous ,

 

Can you attach some sample data here please in a file or may be a sample pbix file that has data within it for this scenario?

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Even I am looking for this feature but based on a name selection. 

 

Can you please help?

 

@amitchandak @Pragati11 @Fowmy 

Anonymous
Not applicable

Hello All,

 

Any help on the above mentioned requirement would be really helpful.

Please Let me know whether that is possible in Power BI or not.

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.