Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Showing filtered out values

Is it possible to filter a colum with a slycer so every non selected Value shows a text like "non selected" and the rest stays the same.
I would need that for a custom legend in a stacked area chart so that every value i didn't select gets combined into one.

Thx for your help in advance.

  • Hi Anonymous -Yes, you can achieve this in Power BI by creating a measure that checks if a value is selected or not.

    SelectedOrNot =
    IF (
    ISFILTERED('Financials'[Segment]),
    IF (
    COUNTROWS(ALLSELECTED('Financials'[Segment])) = COUNTROWS(ALL('Financials'[Segment])),
    "non selected",
    SELECTEDVALUE('Financials'[Segment])
    ),
    "non selected"
    )

     

    If you want to combine non-selected values into one category

    LegendTable =
    UNION (
    DISTINCT (
    SELECTCOLUMNS (
    FILTER (
    'Financials',
    ISFILTERED('Financials'[Segment])
    ),
    "Legend", 'Financials'[Segment]
    )
    ),
    ROW ("Legend", "non selected")
    )

    Ensure that the custom legend (e.g., LegendTable) is used to properly reflect your combined categories in the legend.

     

    Hope this helps in your scenerio.

2 Replies

  • Hi Anonymous -Yes, you can achieve this in Power BI by creating a measure that checks if a value is selected or not.

    SelectedOrNot =
    IF (
    ISFILTERED('Financials'[Segment]),
    IF (
    COUNTROWS(ALLSELECTED('Financials'[Segment])) = COUNTROWS(ALL('Financials'[Segment])),
    "non selected",
    SELECTEDVALUE('Financials'[Segment])
    ),
    "non selected"
    )

     

    If you want to combine non-selected values into one category

    LegendTable =
    UNION (
    DISTINCT (
    SELECTCOLUMNS (
    FILTER (
    'Financials',
    ISFILTERED('Financials'[Segment])
    ),
    "Legend", 'Financials'[Segment]
    )
    ),
    ROW ("Legend", "non selected")
    )

    Ensure that the custom legend (e.g., LegendTable) is used to properly reflect your combined categories in the legend.

     

    Hope this helps in your scenerio.

  • Anonymous's avatar
    Anonymous
    Not applicable

    It only shows non selected now. I have tried it already with the non selected measure but somehow i never get the legend to work properly.