Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
bharosha
Helper I
Helper I

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. 

 

1 ACCEPTED SOLUTION
bharosha
Helper I
Helper I

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

        )

    )

View solution in original post

6 REPLIES 6
bharosha
Helper I
Helper I

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

        )

    )

Jihwan_Kim
Super User
Super User

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.

Jihwan_Kim_1-1753288116543.png

 

 

Jihwan_Kim_0-1753288082762.png

 

 

expected result measure: = 
COUNTROWS(Data)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Here are some screenshots of what I have for dummy data and what I want to get out of. currentlycurrentlydesireddesiredfilter table.pngcategory filter.png

Hi  @bharosha  ,
Thanks for reaching out to the Microsoft fabric community forum. 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.   

Best Regards, 
Community Support Team  

  

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.

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

@v-menakakota and @Jihwan_Kim , 

I have three tables ID only, ID and category, ID and category filter. 

ID is primary table that is connected to other two tables with 1 to many relationship. 

I to display category and counts from "ID and category" table but use filter from "ID and category filter" table. When I select Category A as a filter, as shown in the screenshot above, currently other categories and count show up as well, as they are connected to main primary ID table by ID. I would like to create a filter in such a way that when I select "Category A" as a filter only Category A and count of ID display in the table. Below is my mock data, which is what above screenshots show. If you take a closer look, the desired result is "filter being selected A" and only A and count getting displayed in the table. 

ID and category filter table

IDCategory
1A
1B
1C
3A
3B
4C
5D
6A
7B
7C
7D
8E
3A
2B
2C
2D
9E
9F
9G
4A
4B

ID and category table

IDCategory
1A
1B
1C
3A
3B
4C
5D
6A
7B
7C
7D
8E
3A
2B
2C
2D
9E
9F
9G
4A
4B

ID table

ID
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.