Forum Discussion

bharosha's avatar
bharosha
Helper I
1 year ago
Solved

filter a table using the selected value from another table

I have a table that contains

 

IDCategory
1A
1B
2C
3A
3B
4C
4D
4A
5B

 

I have another table that is setting as a filter in the entire page, which is generating a value of Category. I would like to create a table that shows me number of ids per category of selected value of a category from another table. 

Currently I created a table, category and count of ID

A  3

B  3

C  2

I would like this above table to show only the value selected in other table filter. For example if A is selected, that the above table should show

A 3. 

Currently I created a category = selected value (another category table)

But this formula is stating false when one id is under two categories. 

 

  • I figured out myself Filtered Category Count =

    VAR SelectedCategories = VALUES('ID category filter'[Category])

    RETURN

        CALCULATE(

            DISTINCTCOUNT('ID and category'[ID]),

            FILTER(

                'ID and category',

                'ID and category'[Category] IN SelectedCategories

            )

        )

6 Replies

  • I figured out myself Filtered Category Count =

    VAR SelectedCategories = VALUES('ID category filter'[Category])

    RETURN

        CALCULATE(

            DISTINCTCOUNT('ID and category'[ID]),

            FILTER(

                'ID and category',

                'ID and category'[Category] IN SelectedCategories

            )

        )

  • Hi,

    I am not sure if I understood your question correctly, but I assume your expected result is showing table visualization with a slicer. Please check the below picture and the attached pbix file.

     

     

     

     

    expected result measure: = 
    COUNTROWS(Data)

     

    • bharosha's avatar
      bharosha
      Helper I

      Here are some screenshots of what I have for dummy data and what I want to get out of. currentlydesired

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Super User

        Hi,

        Sorry but it is not clear for me to understand what is the expected outcome.

        In the image you shared, the current one shows with a slicer-visual, but desired one shows no-slicer-visual.

        And, please share your sample pbix file.