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
amirabedhiafi
Impactful Individual
Impactful Individual

Change a column of a table based on a filter

I have a filter containing City/Country :

amirabedhiafi_0-1634392831331.png

I created a table Filters with a column Filtering containing City and Country like above.

When selecting City I want to display the target by city: 

amirabedhiafi_1-1634392950466.png

When selecting Country I want to display the target by country: 

amirabedhiafi_2-1634393001899.png

 

Knowing that I have other filters in the same page like semester ...

 

 

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini
1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @amirabedhiafi ,

Here are the steps you can follow:

1. Use Enter data to create a table.

vyangliumsft_0-1634711512283.png

2. Create measure.

City =
IF(
    CONTAINS(
        'Table',
        'Table'[Slicer Selection],"City"),
        SUMX(FILTER('Filters','Filters'[City]=MAX('Filters'[City])),'Filters'[Target]),BLANK())
Country =
IF(
    CONTAINS(
        'Table',
        'Table'[Slicer Selection],"Country"),       SUMX(FILTER('Filters','Filters'[City]=MAX('Filters'[City])&&'Filters'[Country]=MAX('Filters'[Country])),'Filters'[Target]),BLANK())

3. Use Table's [Slicer Selection] as the slicer

4. Result:

When choosing City as:

vyangliumsft_1-1634711512285.png

When choosing Country as:

vyangliumsft_2-1634711512286.png

Best Regards,

Liu Yang

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

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @amirabedhiafi ,

Here are the steps you can follow:

1. Use Enter data to create a table.

vyangliumsft_0-1634711512283.png

2. Create measure.

City =
IF(
    CONTAINS(
        'Table',
        'Table'[Slicer Selection],"City"),
        SUMX(FILTER('Filters','Filters'[City]=MAX('Filters'[City])),'Filters'[Target]),BLANK())
Country =
IF(
    CONTAINS(
        'Table',
        'Table'[Slicer Selection],"Country"),       SUMX(FILTER('Filters','Filters'[City]=MAX('Filters'[City])&&'Filters'[Country]=MAX('Filters'[Country])),'Filters'[Target]),BLANK())

3. Use Table's [Slicer Selection] as the slicer

4. Result:

When choosing City as:

vyangliumsft_1-1634711512285.png

When choosing Country as:

vyangliumsft_2-1634711512286.png

Best Regards,

Liu Yang

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

aj1973
Community Champion
Community Champion

Hi @amirabedhiafi 

Do you know how to use bookmarks? I would recommend it.

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Yes just tried to use a trick with the filters instead of the bookmarks.

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini

Well try with Bookmarks now,

Put 2 visuals on top of each others, select the filter, and depending on filter selection hide or keep the visual you need to see using bookmarks.

here is a video that could help you

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

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

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.