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
Clax
New Member

How to catch the value from a slicer

Hello all,

I have a table with cities and I want to obtain the same table without the value selected on a single-selection slicer.

   What I have             -        What I want

Clax_0-1709898968137.png           Clax_1-1709899004263.png

I have tried it by creating a measure that catches this value and then filtering the first table. But SELECTEDVALUE(ciudad[ciudad]), that is what I'm using to catch this value, returns always blank.

 

I will appreciate any new idea about how I can reach this out or any tip about how SELECTEDVALUE works.

2 ACCEPTED SOLUTIONS

No my mistake sorry.

This code works at my place

JamesFR06_0-1709914176367.png

FilteredCiud =
var selectciduad=SELECTEDVALUE(Villes[Ciudades])
var t2=CALCULATETABLE(Villes,Villes[Ciudades]=selectciduad)
var t3=CALCULATETABLE(Villes,all(Villes))
var filteredtowns=EXCEPT(t3,t2)
return
COUNTROWS(filteredtowns)

View solution in original post

v-heq-msft
Community Support
Community Support

Hi @Clax ,
Thanks to @Nithinr  for the solution.
Here's another one of my solutions.
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:

vheqmsft_0-1710136657702.png

Create a calculated table

Table 2 = VALUES('Table'[Country])

Create a measure

Measure = 
CALCULATE(
    COUNTX('Table','Table'[Country]),
    FILTER(
        'Table',
        'Table'[Country] <> SELECTEDVALUE('Table 2'[Country])
    )
)

Apply the measure to the filter on this visual to the table view and set the value as "is 1"

vheqmsft_1-1710136791126.png

Drag the table 2 into the slicer
Final output

vheqmsft_2-1710136887456.pngvheqmsft_3-1710136894562.png

 

Best regards,

Albert He

 

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

7 REPLIES 7
v-heq-msft
Community Support
Community Support

Hi @Clax ,
Thanks to @Nithinr  for the solution.
Here's another one of my solutions.
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:

vheqmsft_0-1710136657702.png

Create a calculated table

Table 2 = VALUES('Table'[Country])

Create a measure

Measure = 
CALCULATE(
    COUNTX('Table','Table'[Country]),
    FILTER(
        'Table',
        'Table'[Country] <> SELECTEDVALUE('Table 2'[Country])
    )
)

Apply the measure to the filter on this visual to the table view and set the value as "is 1"

vheqmsft_1-1710136791126.png

Drag the table 2 into the slicer
Final output

vheqmsft_2-1710136887456.pngvheqmsft_3-1710136894562.png

 

Best regards,

Albert He

 

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

Nithinr
Resolver III
Resolver III

Hi @Clax ,  Please find the below solution that worked for me

Create a Calulated table which contains values of the slicer

Slicertable= DISTINCT(ciudad[ciudades])

new tab.png 

Create a relationship between Slicertable and Cities table

rela.png

 

Create Below Measure

Filtered Table = IF ( CALCULATE(COUNT(original[Inventory Number]), 
          original[Inventory Number] = SELECTEDVALUE('original'[Inventory Number])) >0,1,0)

 

Note : Create a slicer using Slicer table

 

Last step make sure filter section select the measure Value as 0 this excludes the selected value in table, please find the screenshot below.

 

filter.png

 

Clax
New Member

Hello JamesFR06,

 

If it is possible to have a dynamic table, that is better. I just was trying with a new table in case it would be easier to succeed.

Ok

So we are going to use selectedvalue on a measure for this

 

Measure=

Var Selectcity=selectedvalue('Table[Ciudades])

var Filteredciudades=filter('Table,'Table[Ciudades]<>Selectcity)

 

Now you dynamic table is ok and for exemple you can count number of rows

return

Countrows(Filteredciudades)

 

 

I've tried that, but I still have the same problem. If I create a visualization for the measure, it is blank. I might be doing something wrong.

Clax_0-1709904188945.png

No my mistake sorry.

This code works at my place

JamesFR06_0-1709914176367.png

FilteredCiud =
var selectciduad=SELECTEDVALUE(Villes[Ciudades])
var t2=CALCULATETABLE(Villes,Villes[Ciudades]=selectciduad)
var t3=CALCULATETABLE(Villes,all(Villes))
var filteredtowns=EXCEPT(t3,t2)
return
COUNTROWS(filteredtowns)
JamesFR06
Resolver IV
Resolver IV

Hello Clax,

 

You want to create a new table or you want a dynamic table ?

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.