Forum Discussion

Clax's avatar
Clax
New Member
2 years ago
Solved

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

           

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.

7 Replies

  • Nithinr's avatar
    Nithinr
    Icon for Resolver III rankResolver 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])

     

    Create a relationship between Slicertable and Cities table

     

    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.

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    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:

    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"

    Drag the table 2 into the slicer
    Final output

     

    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

  • Hello Clax,

     

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

  • Clax's avatar
    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.

    • JamesFR06's avatar
      JamesFR06
      Icon for Resolver IV rankResolver IV

      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)

       

       

      • Clax's avatar
        Clax
        New Member

        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.