Search code examples
powerbidax

Getting the non filtered values from a slicer


_Hi, I try to calculate a table with the values that are NOT selected from my slicer 'Table'[Plan PT] with the following DAX formula :

Measure =
CALCULATETABLE(
    VALUES('Table'[Désignation]),
    FILTER(
        'Table',
        'Table'[Plan PT] <> SELECTEDVALUE('Table'[Plan PT])
    )
)

But it's not working : when I replace selectedvalue with a fixed value ("3" for instance), it then works ? Besides, how can I display this result in the filter context ? Shoul I need a disconnected Table ? Maybe another way ? Thanks for your help.


Solution

  • Note that Calculated Tables and Calculated Columns are calculated at dataset refresh time, and after that they are static. Meaning they will not be re-calculated during report view/interaction time.

    Assuming you want to display a table visual (or any visual) that show all rows that haven't been selected then you can try the following.

    You will need a separate table for your slicer as it is not possible to show rows outside of what has been sliced from the same table.

    Create a Calculated Table that will be used for your slicer. For example:

    Dim Plan PT = DISTINCT('Table'[Plan PT])
    

    Next create a measure similar to:

    Non-selected count = 
      var selected = DISTINCT('Dim Plan PT'[Plan PT])
      return CALCULATE(
        COUNTROWS('Table'),
        NOT 'Table'[Plan PT] IN selected
      )
    

    Then in your visual, add [Non-selected count] as a visual filter in the Filter pane on the right, and set it to is not blank.