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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
smpa01
Super User
Super User

Slicer to filter only a particluar column specified by user

Hi,

 

I have the following table

 

Capture.JPG

When I choose a particular city from the slicer for example,"A", I want only the CAT1 value to be filtered and CAT2 value to remain unchanged. The effect of my desired filtering would be following.

Capture3.JPG

 

Is it possible to achieve ? The raw data is following

 

CityCAT1CAT2
A100-100
B200-200
C300-300
D400-400
E500-500

 

Thank you in advance.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
2 ACCEPTED SOLUTIONS
LivioLanzo
Solution Sage
Solution Sage

Hi @smpa01

 

You are going to have to unpivot your table like this (Power Query is your friend):

 

Capture.PNG

 

Then, build the below model, the Cities Filter table will be the one used in the slicer:

 

Capture.PNG

 

Thent his measure should do what you want:

 

Measure = 
IF(
    SELECTEDVALUE( Categories[Category] ) = "CAT1",
    VAR Val = 
    CALCULATE( 
        SUM( Data[Amount] ), 
        TREATAS( VALUES( CitiesFilter[City] ), Cities[City] ),
        VALUES( Cities[City] )
    )
    RETURN IF( ISBLANK( Val ), 0, Val ),
    SUM( Data[Amount] )
)

 

Capture.PNG

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

View solution in original post

v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @smpa01,

 

You could new a calculated table which should be unrelated to source table. And later, please drag field from this new table to slicer.

Slicer Table = VALUES(Table1[City]) 

2.PNG

 

Add below measure and Table1[CAT2] into visual.

Measure for CAT1 = IF(SELECTEDVALUE(Table1[City])=SELECTEDVALUE('Slicer Table'[City]),SUM(Table1[CAT1]),0)

1.PNG

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

5 REPLIES 5
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @smpa01,

 

You could new a calculated table which should be unrelated to source table. And later, please drag field from this new table to slicer.

Slicer Table = VALUES(Table1[City]) 

2.PNG

 

Add below measure and Table1[CAT2] into visual.

Measure for CAT1 = IF(SELECTEDVALUE(Table1[City])=SELECTEDVALUE('Slicer Table'[City]),SUM(Table1[CAT1]),0)

1.PNG

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
LivioLanzo
Solution Sage
Solution Sage

Hi @smpa01

 

You are going to have to unpivot your table like this (Power Query is your friend):

 

Capture.PNG

 

Then, build the below model, the Cities Filter table will be the one used in the slicer:

 

Capture.PNG

 

Thent his measure should do what you want:

 

Measure = 
IF(
    SELECTEDVALUE( Categories[Category] ) = "CAT1",
    VAR Val = 
    CALCULATE( 
        SUM( Data[Amount] ), 
        TREATAS( VALUES( CitiesFilter[City] ), Cities[City] ),
        VALUES( Cities[City] )
    )
    RETURN IF( ISBLANK( Val ), 0, Val ),
    SUM( Data[Amount] )
)

 

Capture.PNG

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

@LivioLanzothank you very much for taking time to provide the solution. However, I do have a followup question for you if you can spare some time please.

 

How can I alter your code to show the following upon selecting city A from the slicer table. Instead of "zeroing" all the values for CAT1 for unselected cities, I want those values to turn to a "Blank".

 

CityCAT1CAT2
A100-100
B -200
C -300
D -400
E -500

 

Thank you in advance.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Hi @smpa01

 

thx for the feedback.

 

The 0's you need them in order for the liner chart to work as you wanted. Therefore, you need to create a second measure which you will use inside the matrix visual

 

Measure = 
IF(
    SELECTEDVALUE( Categories[Category] ) = "CAT1",
    VAR Val = 
    CALCULATE( 
        SUM( Data[Amount] ), 
        TREATAS( VALUES( CitiesFilter[City] ), Cities[City] ),
        VALUES( Cities[City] )
    )
    RETURN Val,
    SUM( Data[Amount] )
)

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

This is awesome. Thank you.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors